This documentation is archived and is not being maintained.

FtpWebRequest.EndGetResponse Method

Ends a pending asynchronous operation started with BeginGetResponse.

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

Public Overrides Function EndGetResponse ( _
	asyncResult As IAsyncResult _
) As WebResponse
Dim instance As FtpWebRequest 
Dim asyncResult As IAsyncResult 
Dim returnValue As WebResponse 

returnValue = instance.EndGetResponse(asyncResult)


Type: System.IAsyncResult

The IAsyncResult that was returned when the operation started.

Return Value

Type: System.Net.WebResponse
A WebResponse reference that contains an FtpWebResponse instance. This object contains the FTP server's response to the request.


asyncResult is Nothing.


asyncResult was not obtained by calling BeginGetResponse.


This method was already called for the operation identified by asyncResult.

If the operation has not completed at the time the EndGetResponse method is called, EndGetResponse blocks until the operation completes. To prevent blocking, check the IsCompleted property before calling EndGetResponse.

In addition to the exceptions noted in "Exceptions," EndGetResponse 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.

Notes to Callers:

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.

No code example is currently available or this language may not be supported.
    // The EndGetResponseCallback method  
    // completes a call to BeginGetResponse.
    static void EndGetResponseCallback(IAsyncResult* ar)
        FtpState* state = dynamic_cast<FtpState*> (ar->AsyncState);
        FtpWebResponse* response = 0;
            response = dynamic_cast<FtpWebResponse*> (state->Request->EndGetResponse(ar));
            state->StatusDescription = response->StatusDescription;
            // Signal the main application thread that 
            // the operation is complete.
        // Return exceptions to the main application thread.
        catch (Exception* e)
            Console::WriteLine (S"Error getting response.");
            state->OperationException = e;

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0