FtpStatusCode FtpStatusCode FtpStatusCode 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 AccountNeeded AccountNeeded AccountNeeded 532

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

ActionAbortedLocalProcessingError ActionAbortedLocalProcessingError ActionAbortedLocalProcessingError ActionAbortedLocalProcessingError 451

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

ActionAbortedUnknownPageType ActionAbortedUnknownPageType ActionAbortedUnknownPageType 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 ActionNotTakenFilenameNotAllowed ActionNotTakenFilenameNotAllowed ActionNotTakenFilenameNotAllowed 553

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

ActionNotTakenFileUnavailable ActionNotTakenFileUnavailable ActionNotTakenFileUnavailable ActionNotTakenFileUnavailable 550

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

ActionNotTakenFileUnavailableOrBusy ActionNotTakenFileUnavailableOrBusy ActionNotTakenFileUnavailableOrBusy 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 ActionNotTakenInsufficientSpace ActionNotTakenInsufficientSpace ActionNotTakenInsufficientSpace 452

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

ArgumentSyntaxError ArgumentSyntaxError ArgumentSyntaxError ArgumentSyntaxError 501

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

BadCommandSequence BadCommandSequence BadCommandSequence BadCommandSequence 503

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

CantOpenData CantOpenData CantOpenData CantOpenData 425

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

ClosingControl ClosingControl ClosingControl ClosingControl 221

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

ClosingData ClosingData ClosingData ClosingData 226

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

CommandExtraneous CommandExtraneous CommandExtraneous CommandExtraneous 202

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

CommandNotImplemented CommandNotImplemented CommandNotImplemented CommandNotImplemented 502

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

CommandOK CommandOK CommandOK CommandOK 200

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

CommandSyntaxError CommandSyntaxError CommandSyntaxError CommandSyntaxError 500

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

ConnectionClosed ConnectionClosed ConnectionClosed ConnectionClosed 426

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

DataAlreadyOpen DataAlreadyOpen DataAlreadyOpen DataAlreadyOpen 125

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

DirectoryStatus DirectoryStatus DirectoryStatus DirectoryStatus 212

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

EnteringPassive EnteringPassive EnteringPassive EnteringPassive 227

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

FileActionAborted FileActionAborted FileActionAborted FileActionAborted 552

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

FileActionOK FileActionOK FileActionOK FileActionOK 250

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

FileCommandPending FileCommandPending FileCommandPending FileCommandPending 350

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

FileStatus FileStatus FileStatus FileStatus 213

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

LoggedInProceed LoggedInProceed LoggedInProceed LoggedInProceed 230

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

NeedLoginAccount NeedLoginAccount NeedLoginAccount NeedLoginAccount 332

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

NotLoggedIn NotLoggedIn NotLoggedIn NotLoggedIn 530

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

OpeningData OpeningData OpeningData OpeningData 150

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

PathnameCreated PathnameCreated PathnameCreated PathnameCreated 257

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

RestartMarker RestartMarker RestartMarker 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 SendPasswordCommand SendPasswordCommand SendPasswordCommand 331

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

SendUserCommand SendUserCommand SendUserCommand SendUserCommand 220

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

ServerWantsSecureSession ServerWantsSecureSession ServerWantsSecureSession ServerWantsSecureSession 234

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

ServiceNotAvailable ServiceNotAvailable ServiceNotAvailable ServiceNotAvailable 421

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

ServiceTemporarilyNotAvailable ServiceTemporarilyNotAvailable ServiceTemporarilyNotAvailable ServiceTemporarilyNotAvailable 120

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

SystemType SystemType SystemType 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 Undefined Undefined 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".