Hello, I am trying to get a response from a URL using the following method
public void IsUrlReachable()
{
HttpWebRequest webRequest;
WebResponse webResponse = null; //Need to assign this as null otherwise it does not compile
try
{
webRequest = WebRequest.Create("http://[myurl].asmx");
webRequest.Method = "GET";
webRequest.KeepAlive = false;
webResponse = webRequest.GetResponse(); //Assign to webResponse
}
catch (Exception)
{
Debug.WriteLine("Didn't get it");
//Something goes wrong. Implement handling of this exception
}
finally
{
if (webResponse != null)
{
webResponse.Close(); //Close webresponse connection
}
webResponse = null; //To clear up the webresponse
webRequest = null; //To clear up the webrequest
}
}
It tells me the method for WebRequest.Create is not defined so I just generated a sub automatically (Using Visual Studio 2008, if that helps).
internal static System.Net.HttpWebRequest Create(string p)
{
throw new NotImplementedException();
}
It actually does communicate and is able to send data to my webservice yet it will always hit the NotImplementedException, I am guessing I need to put something within the Create method in the WebRequest class, but I have no idea what does here, I am finding it hard to find documentation on this, any guidance? Even if it's just a link
Thank you