I am trying to send data on the server using the following code in windows 7 phone based development.
public static void sendData()
{
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
IAsyncResult token = request.BeginGetResponse(new AsyncCallback(GetStatusesCallBack), request);
}
public static void GetStatusesCallBack(IAsyncResult result)
{
WebResponse response = ((HttpWebRequest)result.AsyncState).EndGetResponse(result);
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseString = reader.ReadToEnd(); reader.Close();
}
Problem is that when I call sendData method, it does not call the callback function GetStatusesCallBack. When i tried to check token object, It contained following entry
'token.AsyncWaitHandle' threw and exception of type 'System.NotSupportedException'
Can anyone please tell me how to fix it?
Best Regards