WebClient.GetWebResponse Method (System.Net) (original) (raw)

Source:

WebClient.cs

Source:

WebClient.cs

Source:

WebClient.cs

Source:

WebClient.cs

protected:
 virtual System::Net::WebResponse ^ GetWebResponse(System::Net::WebRequest ^ request, IAsyncResult ^ result);
protected virtual System.Net.WebResponse GetWebResponse(System.Net.WebRequest request, IAsyncResult result);
abstract member GetWebResponse : System.Net.WebRequest * IAsyncResult -> System.Net.WebResponse
override this.GetWebResponse : System.Net.WebRequest * IAsyncResult -> System.Net.WebResponse
Protected Overridable Function GetWebResponse (request As WebRequest, result As IAsyncResult) As WebResponse

Parameters

Returns

A WebResponse containing the response for the specified WebRequest.

Examples

The following code example shows an implementation of this method that can be customized by a class derived from WebClient.

virtual WebResponse^ GetWebResponse( WebRequest^ request, IAsyncResult^ result ) override
{
   WebResponse^ response = WebClient::GetWebResponse( request, result );

   // Perform any custom actions with the response ...
   return response;
}
protected override WebResponse GetWebResponse (WebRequest request, IAsyncResult result)
{
    WebResponse response = base.GetWebResponse (request, result);
    // Perform any custom actions with the response ...
    return response;
}

Remarks

Caution

WebRequest, HttpWebRequest, ServicePoint, and WebClient are obsolete, and you shouldn't use them for new development. Use HttpClient instead.

The object returned by this method is obtained by calling the EndGetResponse method on the specified WebRequest object.

This method can be called only by classes that inherit from WebClient. It is provided to give inheritors access to the underlying WebResponse object.

Applies to