FtpWebRequest.BeginGetRequestStream Method (AsyncCallback, Object)


Begins asynchronously opening a request's content stream for writing.

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

<HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading := True)>
Public Overrides Function BeginGetRequestStream (
	callback As AsyncCallback,
	state As Object
) As IAsyncResult


Type: System.AsyncCallback

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

Type: System.Object

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

Return Value

Type: System.IAsyncResult

An IAsyncResult instance that indicates the status of the operation.

Exception Condition

A previous call to this method or GetRequestStream has not yet completed.


A connection to the FTP server could not be established.


The Method property is not set to UploadFile.

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

This method does not block while waiting for the stream. To block, call GetRequestStream in place of this method.

For detailed 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 in the .NET Framework.

Notes to Callers:

This method generates network traffic.

The following code example demonstrates beginning an asynchronous operation to get a request's stream. 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.

.NET Framework
Available since 2.0
Return to top