You need a method BeginGetRequestStreambefore getting an answer (note that VB.NET is not my main language).
Public Sub SubmitMessage()
request = WebRequestCreator.ClientHttp.Create(New System.Uri("http://localhost:27856/Home.aspx/PostUpdate/"))
request.Method = "POST"
request.BeginGetRequestStream(New AsyncCallback(AddressOf SendData), Nothing)
End Sub
Public Sub SendData(ByVal ar As IAsyncResult)
Dim stream as Stream = state.Request.EndGetRequestStream(ar)
''
stream.Close()
request.BeingGetResponse(New AsyncCallback(AddressOf UpdateDone), Nothing)
End Sub
Public Sub UpdateDone(ByVal ar As IAsyncResult)
Dim response As HttpWebResponse = request.EndGetResponse(ar)
Using reader As StreamReader = New StreamReader(response.GetResponseStream())
Dim valid As String = reader.ReadToEnd()
End Using
End Sub
It would seem from your answer that you are submitting HTML form data. Here is the right way to create an object body (C # sorry): -
public static string GetUrlEncodedData(Dictionary<string, string> data)
{
var sb = new StringBuilder();
foreach (var kvp in data)
{
if (sb.Length > 0) sb.Append("&");
sb.Append(kvp.Key);
sb.Append("=");
sb.Append(Uri.EscapeDataString(kvp.Value));
}
return sb.ToString();
}
, , Uri.EscapeDataString, Content-Type. , UTF-8.
, , ASCII, ASCII.