Share via


FtpWebRequest Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Implements a File Transfer Protocol (FTP) client.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .MarshalByRefObject
    System.Net. . :: . .WebRequest
      System.Net..::..FtpWebRequest

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

Syntax

'Declaration
Public Class FtpWebRequest _
    Inherits WebRequest
public class FtpWebRequest : WebRequest
public ref class FtpWebRequest : public WebRequest
type FtpWebRequest =  
    class
        inherit WebRequest
    end
public class FtpWebRequest extends WebRequest

The FtpWebRequest type exposes the following members.

Properties

  Name Description
Public property ConnectionGroupName When overridden in a descendant class, gets or sets the name of the connection group for the request. (Inherited from WebRequest.)
Public property ContentLength When overridden in a descendant class, gets or sets the content length of the request data being sent. (Inherited from WebRequest.)
Public property ContentType When overridden in a descendant class, gets or sets the content type of the request data being sent. (Inherited from WebRequest.)
Public property Credentials Gets or sets the credentials used to communicate with the FTP server.
Public property Headers When overridden in a descendant class, gets or sets the collection of header name/value pairs associated with the request. (Inherited from WebRequest.)
Public property Method Gets or sets the command to send to the FTP server. (Overrides WebRequest. . :: . .Method.)
Public property Proxy When overridden in a descendant class, gets or sets the network proxy to use to access this Internet resource. (Inherited from WebRequest.)
Public property RenameTo Gets or sets the new name of a file being renamed.
Public property RequestUri When overridden in a descendant class, gets the URI of the Internet resource associated with the request. (Inherited from WebRequest.)
Public property Timeout Gets or sets the length of time, in milliseconds, before the request times out. (Inherited from WebRequest.)
Public property UsePassive Gets or sets the behavior of a client application's data transfer process.

Top

Methods

  Name Description
Public method Dispose() () () () Releases the resources used by the HttpWebRequest. (Inherited from WebRequest.)
Protected method Dispose(Boolean) Releases the unmanaged resources used by the HttpWebRequest and optionally releases the managed resources. (Inherited from WebRequest.)
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Performs clean up operations. (Inherited from WebRequest.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetRequestStream Retrieves the stream used to upload data to an FTP server. (Overrides WebRequest. . :: . .GetRequestStream() () () ().)
Public method GetResponse Returns the FTP server response. (Overrides WebRequest. . :: . .GetResponse() () () ().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Fields

  Name Description
Public field DataSocketReady Indicates whether the data transmission has started.
Public field FTPActiveAddress Contains the active address.
Public field FTPActivePort Contains the active port.
Public field RequestPath Contains the request path.
Public field ServerIP Contains the IP address of the server.
Public field ServerPort Contains the port number of the server.
Public field TransmissionFinished Indicates whether the data transmission has finished.

Top

Remarks

To obtain an instance of FtpWebRequest, use the Create method.

You must have a valid user name and password for the server or the server must allow anonymous logon. You can specify the credentials used to connect to the server by setting the Credentials property.

Specify the FTP command to send to the server by setting the Method property to a value defined in the WebRequestMethods..::..Ftp structure.

Requests are sent to the server by calling the GetResponse method. When the requested operation completes, an FtpWebResponse object is returned. The FtpWebResponse object provides the status of the operation and any data downloaded from the server.

When downloading a file from an FTP server, if the command was successful, the contents of the requested file are available in the response object's stream. You can access this stream by calling the GetResponseStream method. For more information, see FtpWebResponse.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Net Namespace