HttpWebRequest.EndGetResponse Method (IAsyncResult)


Ends an asynchronous request to an Internet resource.

Namespace:   System.Net
Assembly:  System (in System.dll)

override EndGetResponse : 
        asyncResult:IAsyncResult -> WebResponse


Type: System.IAsyncResult

The pending request for a response.

Return Value

Type: System.Net.WebResponse

A WebResponse that contains the response from the Internet resource.

Exception Condition

asyncResult is null.


This method was called previously using asyncResult.


The ContentLength property is greater than 0 but the data has not been written to the request stream.


Abort was previously called.


An error occurred while processing the request.


asyncResult was not returned by the current instance from a call to BeginGetResponse.

The EndGetResponse method completes an asynchronous request for an Internet resource that was started by calling the BeginGetResponse method.


You must call the Close method to close the stream and release the connection. Failure to do so may cause your application to run out of connections.


This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing in the .NET Framework.

The following code example uses the EndGetResponse method to end an asynchronous request for an Internet resource.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top