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 서버에서 반환됩니다. 메서드 StatusDescription 를 호출한 GetResponse 후 에는 중간 상태 코드가 포함됩니다. 메서드 StatusDescription 를 호출할 Close 때 최종 상태 포함합니다.

적용 대상

추가 정보