Ends a pending asynchronous operation started with BeginGetResponse.
Assembly: System (in System.dll)
'Declaration Public Overrides Function EndGetResponse ( _ asyncResult As IAsyncResult _ ) As WebResponse
If the operation has not completed at the time the method is called, blocks until the operation completes. To prevent blocking, check the IsCompleted property before calling .
In addition to the exceptions noted in "Exceptions," rethrows exceptions that were thrown while communicating with the server.
This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing.
This method generates network traffic.
The following code example demonstrates ending an asynchronous operation to get a response. This code example is part of a larger example provided for the FtpWebRequest class overview.
' The EndGetResponseCallback method ' completes a call to BeginGetResponse. Private Shared Sub EndGetResponseCallback(ByVal ar As IAsyncResult) Dim state As FtpState = CType(ar.AsyncState, FtpState) Dim response As FtpWebResponse = Nothing Try response = CType(state.Request.EndGetResponse(ar), FtpWebResponse) response.Close() state.StatusDescription = response.StatusDescription ' Signal the main application thread that ' the operation is complete. state.OperationComplete.Set() ' Return exceptions to the main application thread. Catch e As Exception Console.WriteLine("Error getting response.") state.OperationException = e state.OperationComplete.Set() End Try End Sub
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.