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

Parameters

asyncResult
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
ArgumentNullException

asyncResult is null.

InvalidOperationException

This method was called previously using asyncResult.

-or-

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

WebException

Abort was previously called.

-or-

An error occurred while processing the request.

ArgumentException

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.

System_CAPS_cautionCaution

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.

System_CAPS_noteNote

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
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: