System.Net.HttpWebRequest.EndGetResponse Method

Ends an asynchronous request to an Internet resource.

Syntax

public override WebResponse EndGetResponse (IAsyncResult asyncResult)

Parameters

asyncResult
The pending request for a response.

Returns

A System.Net.WebResponse that contains the response from the Internet resource.

Exceptions

TypeReason
ArgumentNullException asyncResult is null.
ArgumentException asyncResult was not returned by the current instance from a call to WebRequest.BeginGetResponse(AsyncCallback, object).
InvalidOperationException

This method was called previously using asyncResult.

-or-

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

System.Net.WebException

HttpWebRequest.Abort was previously called.

-or-

An error occurred while processing the request.

Remarks

The HttpWebRequest.EndGetResponse(IAsyncResult) method completes an asynchronous request for an Internet resource that was started by calling the HttpWebRequest.BeginGetResponse(AsyncCallback, object) method.

Note:

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

Note:

This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

Requirements

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