System.Net.FtpWebRequest.GetRequestStream Method

Retrieves the stream used to upload data to an FTP server.

Syntax

public override System.IO.Stream GetRequestStream ()

Returns

A writable System.IO.Stream instance used to store data to be sent to the server by the current request.

Remarks

Set the request properties before calling the FtpWebRequest.GetRequestStream method. After writing the data to the stream, you must close the stream prior to sending the request.

If you have not set the FtpWebRequest.Method property to System.Net.WebRequestMethods.Ftp.UploadFile or System.Net.WebRequestMethods.Ftp.AppendFile, you cannot get the stream.

FtpWebRequest.GetRequestStream blocks while waiting for the stream. To prevent this, call the FtpWebRequest.BeginGetRequestStream(AsyncCallback, object) method in place of FtpWebRequest.GetRequestStream.

Note:

This member outputs trace information when you enable network tracing in your application. For more information, see [<topic://conUsingNetworkTracing>].

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0