Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

FtpStatusCode Enumeration

Specifies the status codes returned for a File Transfer Protocol (FTP) operation.

Namespace:  System.Net
Assembly:  System (in System.dll)
public enum FtpStatusCode
Member nameDescription
UndefinedIncluded for completeness, this value is never returned by servers.
RestartMarkerSpecifies that the response contains a restart marker reply. The text of the description that accompanies this status contains the user data stream marker and the server marker.
ServiceTemporarilyNotAvailableSpecifies that the service is not available now; try your request later.
DataAlreadyOpenSpecifies that the data connection is already open and the requested transfer is starting.
OpeningDataSpecifies that the server is opening the data connection.
CommandOKSpecifies that the command completed successfully.
CommandExtraneousSpecifies that the command is not implemented by the server because it is not needed.
DirectoryStatusSpecifies the status of a directory.
FileStatusSpecifies the status of a file.
SystemTypeSpecifies the system type name using the system names published in the Assigned Numbers document published by the Internet Assigned Numbers Authority.
SendUserCommandSpecifies that the server is ready for a user login operation.
ClosingControlSpecifies that the server is closing the control connection.
ClosingDataSpecifies that the server is closing the data connection and that the requested file action was successful.
EnteringPassiveSpecifies that the server is entering passive mode.
LoggedInProceedSpecifies that the user is logged in and can send commands.
ServerWantsSecureSessionSpecifies that the server accepts the authentication mechanism specified by the client, and the exchange of security data is complete.
FileActionOKSpecifies that the requested file action completed successfully.
PathnameCreatedSpecifies that the requested path name was created.
SendPasswordCommandSpecifies that the server expects a password to be supplied.
NeedLoginAccountSpecifies that the server requires a login account to be supplied.
FileCommandPendingSpecifies that the requested file action requires additional information.
ServiceNotAvailableSpecifies that the service is not available.
CantOpenDataSpecifies that the data connection cannot be opened.
ConnectionClosedSpecifies that the connection has been closed.
ActionNotTakenFileUnavailableOrBusySpecifies that the requested action cannot be performed on the specified file because the file is not available or is being used.
ActionAbortedLocalProcessingErrorSpecifies that an error occurred that prevented the request action from completing.
ActionNotTakenInsufficientSpaceSpecifies that the requested action cannot be performed because there is not enough space on the server.
CommandSyntaxErrorSpecifies that the command has a syntax error or is not a command recognized by the server.
ArgumentSyntaxErrorSpecifies that one or more command arguments has a syntax error.
CommandNotImplementedSpecifies that the command is not implemented by the FTP server.
BadCommandSequenceSpecifies that the sequence of commands is not in the correct order.
NotLoggedInSpecifies that login information must be sent to the server.
AccountNeededSpecifies that a user account on the server is required.
ActionNotTakenFileUnavailableSpecifies that the requested action cannot be performed on the specified file because the file is not available.
ActionAbortedUnknownPageTypeSpecifies that the requested action cannot be taken because the specified page type is unknown. Page types are described in RFC 959 Section 3.1.2.3
FileActionAbortedSpecifies that the requested action cannot be performed.
ActionNotTakenFilenameNotAllowedSpecifies that the requested action cannot be performed on the specified file.

The FtpStatusCode enumeration defines the values returned in the StatusCode property.

For additional information about FTP server status codes, see RFC 959, "File Transfer Protocol," Section 4.2, "FTP Replies," available at http://www.rfc-editor.org.

The following code example sends an FTP request to make a new directory on an FTP server and checks the status code returned in the response.

public static bool MakeDirectoryOnServer (Uri serverUri)
{
    // The serverUri should start with the ftp:// scheme. 
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }

    // Get the object used to communicate with the server.
    FtpWebRequest request = (FtpWebRequest)WebRequest.Create (serverUri);
    request.KeepAlive = true;
    request.Method = WebRequestMethods.Ftp.MakeDirectory;
    FtpWebResponse response = (FtpWebResponse)request.GetResponse ();
    Console.WriteLine ("Status: {0}", response.StatusDescription);
    return true;
}
public:
    static bool MakeDirectoryOnServer (Uri* serverUri)
    {
        // The serverUri should start with the ftp:// scheme.
        if (serverUri->Scheme != Uri::UriSchemeFtp)
        {
            return false;
        }

        // Get the object used to communicate with the server.
        FtpWebRequest* request = dynamic_cast<FtpWebRequest*>(WebRequest::Create (serverUri));
        request->Method = FtpMethods::MakeDirectory;
        FtpWebResponse* response = dynamic_cast<FtpWebResponse*>(request->GetResponse ());
        Console::WriteLine (S"Status: {0}", response->StatusDescription);
        return true;
    }

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.