FtpStatusCode Enum


指定为文件传输协议 (FTP) 操作返回的状态代码。Specifies the status codes returned for a File Transfer Protocol (FTP) operation.

public enum class FtpStatusCode
public enum FtpStatusCode
type FtpStatusCode = 
Public Enum FtpStatusCode


AccountNeeded 532

指示需要服务器上的用户帐户。Specifies that a user account on the server is required.

ActionAbortedLocalProcessingError 451

指示发生了阻止完成请求操作的错误。Specifies that an error occurred that prevented the request action from completing.

ActionAbortedUnknownPageType 551

指示不能采取请求的操作,因为指定的页类型是未知的。Specifies that the requested action cannot be taken because the specified page type is unknown. RFC 959 的 节中介绍了页类型。Page types are described in RFC 959 Section

ActionNotTakenFilenameNotAllowed 553

指定无法对指定文件执行请求的操作。Specifies that the requested action cannot be performed on the specified file.

ActionNotTakenFileUnavailable 550

指定无法对指定文件执行请求的操作,原因是该文件不可用。Specifies that the requested action cannot be performed on the specified file because the file is not available.

ActionNotTakenFileUnavailableOrBusy 450

指定无法对指定文件执行请求的操作,原因是该文件不可用或正在使用中。Specifies that the requested action cannot be performed on the specified file because the file is not available or is being used.

ActionNotTakenInsufficientSpace 452

指示不能执行请求的操作,因为服务器上没有足够的空间。Specifies that the requested action cannot be performed because there is not enough space on the server.

ArgumentSyntaxError 501

指示一个或多个命令参数具有语法错误。Specifies that one or more command arguments has a syntax error.

BadCommandSequence 503

指示命令序列的顺序不正确。Specifies that the sequence of commands is not in the correct order.

CantOpenData 425

指示无法打开数据连接。Specifies that the data connection cannot be opened.

ClosingControl 221

指示服务器正在关闭管理连接。Specifies that the server is closing the control connection.

ClosingData 226

指示服务器正在关闭数据连接,并且请求的文件操作成功。Specifies that the server is closing the data connection and that the requested file action was successful.

CommandExtraneous 202

指示服务器未执行该命令,因为无需此命令。Specifies that the command is not implemented by the server because it is not needed.

CommandNotImplemented 502

指示 FTP 服务器未执行该命令。Specifies that the command is not implemented by the FTP server.

CommandOK 200

指示命令成功完成。Specifies that the command completed successfully.

CommandSyntaxError 500

指示命令具有语法错误或不是服务器可识别的命令。Specifies that the command has a syntax error or is not a command recognized by the server.

ConnectionClosed 426

指示连接已关闭。Specifies that the connection has been closed.

DataAlreadyOpen 125

指示数据连接已打开并且请求的传输已开始。Specifies that the data connection is already open and the requested transfer is starting.

DirectoryStatus 212

指示目录状态。Specifies the status of a directory.

EnteringPassive 227

指示服务器正在进入被动模式。Specifies that the server is entering passive mode.

FileActionAborted 552

指示不能执行请求的操作。Specifies that the requested action cannot be performed.

FileActionOK 250

指示请求的文件操作成功完成。Specifies that the requested file action completed successfully.

FileCommandPending 350

指示请求的文件操作需要其他信息。Specifies that the requested file action requires additional information.

FileStatus 213

指示文件状态。Specifies the status of a file.

LoggedInProceed 230

指示用户已登录且可发送命令。Specifies that the user is logged in and can send commands.

NeedLoginAccount 332

指示服务器需要提供登录帐户。Specifies that the server requires a login account to be supplied.

NotLoggedIn 530

指示登录信息必须发送到服务器。Specifies that login information must be sent to the server.

OpeningData 150

指示服务器正在打开数据连接。Specifies that the server is opening the data connection.

PathnameCreated 257

指示请求的路径名已创建。Specifies that the requested path name was created.

RestartMarker 110

指示响应包含一个重新启动标记回复。Specifies 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.

SendPasswordCommand 331

指示服务器需要提供密码。Specifies that the server expects a password to be supplied.

SendUserCommand 220

指示服务器已能进行用户登录操作。Specifies that the server is ready for a user login operation.

ServerWantsSecureSession 234

指示服务器接受客户端指定的身份验证机制,并且安全数据交换完成。Specifies that the server accepts the authentication mechanism specified by the client, and the exchange of security data is complete.

ServiceNotAvailable 421

指示此服务不可用。Specifies that the service is not available.

ServiceTemporarilyNotAvailable 120

指示此服务现在不可用;请稍后再试您的请求。Specifies that the service is not available now; try your request later.

SystemType 215

指示使用 Internet Assigned Numbers Authority(Internet 号码分配机构)出版的 Assigned Numbers(号码分配)文档中发布的系统名的系统类型名称。Specifies the system type name using the system names published in the Assigned Numbers document published by the Internet Assigned Numbers Authority.

Undefined 0

包含此值是为了完整性,服务器从不返回此值。Included for completeness, this value is never returned by servers.


下面的代码示例将发送一个 FTP 请求,以便在 FTP 服务器上创建一个新目录,并检查响应中返回的状态代码。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.

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 = WebRequestMethods::Ftp::MakeDirectory;
   FtpWebResponse^ response = dynamic_cast<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 = (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;


FtpStatusCode 枚举定义在 StatusCode 属性中返回的值。The FtpStatusCode enumeration defines the values returned in the StatusCode property.

有关 FTP 服务器状态代码的其他信息,请参阅RFC 959: "文件传输协议",第4.2 节: "FTP 答复"For additional information about FTP server status codes, see RFC 959: "File Transfer Protocol", Section 4.2: "FTP Replies".

Applies to

See also