System.Net.WebRequest.GetResponse Method

When overridden in a descendant class, returns a response to an Internet request.


public virtual WebResponse GetResponse ()


A System.Net.WebResponse containing the response to the Internet request.


NotSupportedExceptionThis method is not overridden in the derived class.

The request timed out.


An error occurred while processing the request.


The WebRequest.GetResponse method sends a request to an Internet resource and returns a System.Net.WebResponse instance. If the request has already been initiated by a call to WebRequest.GetRequestStream, the WebRequest.GetResponse method completes the request and returns any response.

The WebRequest.GetResponse method provides synchronous access to the System.Net.WebResponse. For asynchronous access, use the WebRequest.BeginGetResponse(AsyncCallback, object) and WebRequest.EndGetResponse(IAsyncResult) methods.


The System.Net.WebRequest class is an abstract class. The actual behavior of System.Net.WebRequest instances at run time is determined by the descendant class returned by the WebRequest.Create(Uri) method. For more information about default values and exceptions, see the documentation for the descendant classes, such as System.Net.HttpWebRequest and System.Net.FileWebRequest.


If a WebException is thrown, use the WebException.Response and WebException.Status properties of the exception to determine the response from the server.


Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0,,