System.Net.FtpWebRequest.Method Property

Gets or sets the command to send to the FTP server.

Syntax

public override string Method { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

The FtpWebRequest.Method property determines which command is sent to the server. You set the FtpWebRequest.Method by using the strings defined in the public field members of the System.Net.WebRequestMethods.Ftp class. Note that the strings defined in the System.Net.WebRequestMethods.Ftp class are the only supported options for the FtpWebRequest.Method property. Setting the FtpWebRequest.Method property to any other value will result in an ArgumentException exception.

When setting FtpWebRequest.Method to System.Net.WebRequestMethods.Ftp.UploadFile, you must do so before calling the FtpWebRequest.GetRequestStream method. Failure to call these members in the correct order causes a System.Net.ProtocolViolationException exception when you attempt to get the request stream.

The credentials supplied for the System.Net.FtpWebRequest object must have permission to perform the specified method. If not, the FTP command fails.

To determine the success or failure of a command, check the FtpWebResponse.StatusCode and FtpWebResponse.StatusDescription properties.

Requirements

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