Export (0) Print
Expand All

FtpWebRequest.BeginGetResponse Method

Note: This method is new in the .NET Framework version 2.0.

Begins sending a request and receiving a response from an FTP server asynchronously.

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

'Declaration
Public Overrides Function BeginGetResponse ( _
	callback As AsyncCallback, _
	state As Object _
) As IAsyncResult
'Usage
Dim instance As FtpWebRequest
Dim callback As AsyncCallback
Dim state As Object
Dim returnValue As IAsyncResult

returnValue = instance.BeginGetResponse(callback, state)
public IAsyncResult BeginGetResponse (
	AsyncCallback callback, 
	Object state
)
public override function BeginGetResponse (
	callback : AsyncCallback, 
	state : Object
) : IAsyncResult

Parameters

callback

An AsyncCallback delegate that references the method to invoke when the operation is complete.

state

A user-defined object that contains information about the operation. This object is passed to the callback delegate when the operation completes.

Return Value

An IAsyncResult instance that indicates the status of the operation.

Exception typeCondition

InvalidOperationException

GetResponse or BeginGetResponse has already been called for this instance.

You must complete the asynchronous operation by calling the EndGetResponse method. Typically, EndGetResponse is called by the method referenced by callback. To determine the state of the operation, check the properties in the IAsyncResult object returned by the BeginGetResponse method.

If the Proxy property is set, either directly or in a configuration file, communications with the FTP server are made through the specified proxy.

BeginGetResponse does not block while waiting for the response from the server. To block, call the GetResponse method in place of BeginGetResponse.

For more information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously.

This member outputs trace information when you enable network tracing in your application. For more information, see Network Tracing.

NoteNote

If a WebException is thrown, use the Response and Status properties of the exception to determine the response from the server.

Notes to Callers This method generates network traffic.

The following code example demonstrates ending an asynchronous operation to get a request's stream, and then starting a request to get the 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.

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

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft