FtpWebRequest.BeginGetRequestStream Method (AsyncCallback, Object)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

[<HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)>]
override BeginGetRequestStream : 
        callback:AsyncCallback *
        state:Object -> IAsyncResult

Parameters

callback
Type: System.AsyncCallback

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

state
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
InvalidOperationException

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

WebException

A connection to the FTP server could not be established.

ProtocolViolationException

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.

System_CAPS_noteNote

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
Show: