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

Use this and specify the URL properly

private void RequestResponse()
    {
        try
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(@"http://192.168.00.000/Folder/test123.html");
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            StreamReader sr = new StreamReader(response.GetResponseStream());
            string strRead = sr.ReadToEnd();
            txtHTMLContent.Text = strRead;
            sr.Close();
        }
        catch
        {
      
        }
    }

Ahh I solved it

string url = "http://www.theurlIamusing.com/fu.asmx";

public bool IsUrlReachable(Uri url)
		{
			///Variable used 
			bool isUrlReachable = false;
			///Defines the request and response to the web server
			HttpWebRequest httpRequest = null;
			HttpWebResponse httpResponse = null;

			try
			{
				///Uses the hardcoded url to create a request
				httpRequest = (HttpWebRequest)WebRequest.Create(url);
				///"Gets" the response
				httpRequest.Method = "GET";
				httpResponse = (HttpWebResponse)httpRequest.GetResponse();
				///If it can get it then DmsWebService is accessible and alive
				isUrlReachable = true;
			}
			///Catches the predicted WebException if the DmsWebService is down
			catch (WebException)
			{
				isUrlReachable = false;
			}
			finally
			{
				///Closes the responses
				if (httpResponse != null)
					httpResponse.Close();
			}
			///Returns the boolean
			return isUrlReachable;
		}

I will mark it as solved

This question has already been answered. Start a new discussion instead.