I have asp.net web service. The web service has url like this:
mydomain dot com/service.asmx/getlocation?id=100
I always get below error. I tried both synchronous and async ways. I even tried to use Google.com but I always get below error:
Unhandled Exception:
System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
My code looks like this:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(url));
request.ContentType = "application/json";
request.Timeout = 60000;
request.Method = "GET";
// I get error here
using (WebResponse response = request.GetResponse())
{
// Get a stream representation of the HTTP web response:
using (Stream stream = response.GetResponseStream())
{
// Use this stream to build a JSON document object:
JsonValue jsonDoc = await Task.Run(() => JsonObject.Load(stream));
Console.Out.WriteLine("Response: {0}", jsonDoc.ToString());
// Return the JSON document:
return jsonDoc;
}
}
Thanks
Edit:
I tried it on different emulators- Nexus 7 Lollipop(5.1.0) and Nexus S(4.4.2)