FtpWebResponse.StatusDescription プロパティ

定義

FTP サーバーから送信されたステータス コードを示すテキストを取得します。

public:
 property System::String ^ StatusDescription { System::String ^ get(); };
public string? StatusDescription { get; }
public string StatusDescription { get; }
member this.StatusDescription : string
Public ReadOnly Property StatusDescription As String

プロパティ値

この応答で返されたステータス コードとメッセージを格納している String インスタンス。

次のコード例では、FTP サーバー上のファイルを削除する要求を送信し、要求に対するサーバーの応答からステータス メッセージを表示します。

static bool DeleteFileOnServer( Uri^ serverUri )
{
   // The serverUri parameter should use the ftp:// scheme.
   // It contains the name of the server file that is to be deleted.
   // Example: ftp://contoso.com/someFile.txt.
   // 
   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::DeleteFile;
   FtpWebResponse^ response = dynamic_cast<FtpWebResponse^>(request->GetResponse());
   Console::WriteLine( "Delete status: {0}", response->StatusDescription );
   response->Close();
   return true;
}
public static bool DeleteFileOnServer(Uri serverUri)
{
    // The serverUri parameter should use the ftp:// scheme.
    // It contains the name of the server file that is to be deleted.
    // Example: ftp://contoso.com/someFile.txt.
    //

    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }
    // Get the object used to communicate with the server.
    FtpWebRequest request = (FtpWebRequest)WebRequest.Create(serverUri);
    request.Method = WebRequestMethods.Ftp.DeleteFile;

    FtpWebResponse response = (FtpWebResponse) request.GetResponse();
    Console.WriteLine("Delete status: {0}",response.StatusDescription);
    response.Close();
    return true;
}

注釈

プロパティによって StatusDescription 返されるテキストには、3 桁 StatusCode のプロパティ値が含まれます。 データをダウンロードすると、ステータス コードとしての変更の StatusDescription 値が FTP サーバーによって返されます。 メソッドを呼び出した GetResponse 後、 StatusDescription には中間状態コードが含まれます。 メソッドを Close 呼び出すと、 StatusDescription 最終的な状態が含まれます。

適用対象

こちらもご覧ください