FtpWebResponse.StatusDescription Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene il testo che descrive il codice di stato inviato dal server 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
Valore della proprietà
Istanza di String contenente il codice di stato e il messaggio restituiti con questa risposta.
Esempio
Nell'esempio di codice seguente viene inviata una richiesta di eliminazione di un file in un server FTP e viene visualizzato il messaggio di stato dalla risposta del server alla richiesta.
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;
}
Commenti
Il testo restituito dalla StatusDescription proprietà include il valore della proprietà a 3 cifre StatusCode . Durante il download dei dati, il valore delle modifiche come codici di StatusDescription stato viene restituito dal server FTP. Dopo aver chiamato il GetResponse metodo , StatusDescription contiene un codice di stato intermedio. Quando si chiama il Close metodo , StatusDescription contiene lo stato finale.
Si applica a
Vedi anche
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per