- Feb 24, 2014
- 4
- 0
- 0
Hi,
I am new in windows mobile app development. I want to get http response from third party url(like API response). I tried all way but i didn't get any response its always return "Web Exception" , i am not able find the exact. Can anyone please help me.
below my code
Regards,
Arunabathan.G
I am new in windows mobile app development. I want to get http response from third party url(like API response). I tried all way but i didn't get any response its always return "Web Exception" , i am not able find the exact. Can anyone please help me.
below my code
Code:
HttpWebRequest request_res = (HttpWebRequest)WebRequest.Create("http://google.com");
request_res.Method = "GET";
request_res.BeginGetResponse(new AsyncCallback(responseCallback) , request_res);
private void responseCallback(IAsyncResult result) {
try {
HttpWebRequest request = (HttpWebRequest)result.AsyncState;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
TextReader reader = new StreamReader(response.GetResponseStream());
string strResponse = reader.ReadToEnd();
} catch (System.Net.WebException ex) {
MessageBox.Show(ex.ToString());
}
}
Regards,
Arunabathan.G