FtpWebRequest FtpWebRequest FtpWebRequest FtpWebRequest Class

Definición

Implementa un cliente de protocolo de transferencia de archivos (FTP). Implements a File Transfer Protocol (FTP) client.

public ref class FtpWebRequest sealed : System::Net::WebRequest
public sealed class FtpWebRequest : System.Net.WebRequest
type FtpWebRequest = class
    inherit WebRequest
Public NotInheritable Class FtpWebRequest
Inherits WebRequest
Herencia

Ejemplos

En el ejemplo de código siguiente se muestra cómo eliminar un archivo desde un servidor FTP.The following code example demonstrates deleting a file from an FTP server.

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;
}

En el ejemplo de código siguiente se muestra cómo descargar un archivo desde un servidor FTP mediante el WebClient clase.The following code example demonstrates downloading a file from an FTP server by using the WebClient class.

static bool DisplayFileFromServer( Uri^ serverUri )
{
   // The serverUri parameter should start with the ftp:// scheme.
   if ( serverUri->Scheme != Uri::UriSchemeFtp )
   {
      return false;
   }

   // Get the object used to communicate with the server.
   WebClient^ request = gcnew WebClient;

   // This example assumes the FTP site uses anonymous logon.
   request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" );
   try
   {
      array<Byte>^newFileData = request->DownloadData( serverUri->ToString() );
      String^ fileString = System::Text::Encoding::UTF8->GetString( newFileData );
      Console::WriteLine( fileString );
   }
   catch ( WebException^ e ) 
   {
      Console::WriteLine( e );
   }

   return true;
}
public static bool DisplayFileFromServer(Uri serverUri)
{
    // The serverUri parameter should start with the ftp:// scheme.
    if (serverUri.Scheme != Uri.UriSchemeFtp)
    {
        return false;
    }
    // Get the object used to communicate with the server.
    WebClient request = new WebClient();
    
    // This example assumes the FTP site uses anonymous logon.
    request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");
    try 
    {
        byte [] newFileData = request.DownloadData (serverUri.ToString());
        string fileString = System.Text.Encoding.UTF8.GetString(newFileData);
        Console.WriteLine(fileString);
    }
    catch (WebException e)
    {
        Console.WriteLine(e.ToString());
    }
    return true;
}

En el ejemplo de código siguiente se muestra cómo utilizar las operaciones asincrónicas para cargar un archivo a un servidor FTP.The following code example demonstrates using asynchronous operations to upload a file to an FTP server.

#using <System.dll>

using namespace System;
using namespace System::Net;
using namespace System::Threading;
using namespace System::IO;

public ref class FtpState
{
private:
   ManualResetEvent^ wait;
   FtpWebRequest^ request;
   String^ fileName;
   Exception^ operationException;
   String^ status;

public:
   FtpState()
   {
      wait = gcnew ManualResetEvent( false );
   }

   property ManualResetEvent^ OperationComplete 
   {
      ManualResetEvent^ get()
      {
         return wait;
      }

   }

   property FtpWebRequest^ Request 
   {
      FtpWebRequest^ get()
      {
         return request;
      }

      void set( FtpWebRequest^ value )
      {
         request = value;
      }

   }

   property String^ FileName 
   {
      String^ get()
      {
         return fileName;
      }

      void set( String^ value )
      {
         fileName = value;
      }

   }

   property Exception^ OperationException 
   {
      Exception^ get()
      {
         return operationException;
      }

      void set( Exception^ value )
      {
         operationException = value;
      }

   }

   property String^ StatusDescription 
   {
      String^ get()
      {
         return status;
      }

      void set( String^ value )
      {
         status = value;
      }

   }
};

public ref class AsynchronousFtpUpLoader
{
public:

   // Command line arguments are two strings:
   // 1. The url that is the name of the file being uploaded to the server.
   // 2. The name of the file on the local machine.
   //
   static void Main()
   {
      array<String^>^args = Environment::GetCommandLineArgs();

      // Create a Uri instance with the specified URI string.
      // If the URI is not correctly formed, the Uri constructor
      // will throw an exception.
      ManualResetEvent^ waitObject;
      Uri^ target = gcnew Uri( args[ 1 ] );
      String^ fileName = args[ 2 ];
      FtpState^ state = gcnew FtpState;
      FtpWebRequest ^ request = dynamic_cast<FtpWebRequest^>(WebRequest::Create( target ));
      request->Method = WebRequestMethods::Ftp::UploadFile;

      // This example uses anonymous logon.
      // The request is anonymous by default; the credential does not have to be specified. 
      // The example specifies the credential only to
      // control how actions are logged on the server.
      request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" );

      // Store the request in the object that we pass into the
      // asynchronous operations.
      state->Request = request;
      state->FileName = fileName;

      // Get the event to wait on.
      waitObject = state->OperationComplete;

      // Asynchronously get the stream for the file contents.
      request->BeginGetRequestStream( gcnew AsyncCallback( EndGetStreamCallback ), state );

      // Block the current thread until all operations are complete.
      waitObject->WaitOne();

      // The operations either completed or threw an exception.
      if ( state->OperationException != nullptr )
      {
         throw state->OperationException;
      }
      else
      {
         Console::WriteLine( "The operation completed - {0}", state->StatusDescription );
      }
   }

private:
   static void EndGetStreamCallback( IAsyncResult^ ar )
   {
      FtpState^ state = dynamic_cast<FtpState^>(ar->AsyncState);
      Stream^ requestStream = nullptr;

      // End the asynchronous call to get the request stream.
      try
      {
         requestStream = state->Request->EndGetRequestStream( ar );

         // Copy the file contents to the request stream.
         const int bufferLength = 2048;
         array<Byte>^buffer = gcnew array<Byte>(bufferLength);
         int count = 0;
         int readBytes = 0;
         FileStream^ stream = File::OpenRead( state->FileName );
         do
         {
            readBytes = stream->Read( buffer, 0, bufferLength );
            requestStream->Write( buffer, 0, bufferLength );
            count += readBytes;
         }
         while ( readBytes != 0 );
         Console::WriteLine( "Writing {0} bytes to the stream.", count );

         // IMPORTANT: Close the request stream before sending the request.
         requestStream->Close();

         // Asynchronously get the response to the upload request.
         state->Request->BeginGetResponse( gcnew AsyncCallback( EndGetResponseCallback ), state );
      }
      // Return exceptions to the main application thread.
      catch ( Exception^ e ) 
      {
         Console::WriteLine( "Could not get the request stream." );
         state->OperationException = e;
         state->OperationComplete->Set();
         return;
      }
   }

   // The EndGetResponseCallback method  
   // completes a call to BeginGetResponse.
   static void EndGetResponseCallback( IAsyncResult^ ar )
   {
      FtpState^ state = dynamic_cast<FtpState^>(ar->AsyncState);
      FtpWebResponse ^ response = nullptr;
      try
      {
         response = dynamic_cast<FtpWebResponse^>(state->Request->EndGetResponse( ar ));
         response->Close();
         state->StatusDescription = response->StatusDescription;

         // Signal the main application thread that 
         // the operation is complete.
         state->OperationComplete->Set();
      }
      // Return exceptions to the main application thread.
      catch ( Exception^ e ) 
      {
         Console::WriteLine( "Error getting response." );
         state->OperationException = e;
         state->OperationComplete->Set();
      }
   }
};

int main()
{
   AsynchronousFtpUpLoader::Main();
}
using System;
using System.Net;
using System.Threading;

using System.IO;
namespace Examples.System.Net
{
    public class FtpState
    {
        private ManualResetEvent wait;
        private FtpWebRequest request;
        private string fileName;
        private Exception operationException = null;
        string status;
        
        public FtpState()
        {
            wait = new ManualResetEvent(false);
        }
        
        public ManualResetEvent OperationComplete
        {
            get {return wait;}
        }
        
        public FtpWebRequest Request
        {
            get {return request;}
            set {request = value;}
        }
        
        public string FileName
        {
            get {return fileName;}
            set {fileName = value;}
        }
        public Exception OperationException
        {
            get {return operationException;}
            set {operationException = value;}
        }
        public string StatusDescription
        {
            get {return status;}
            set {status = value;}
        }
    }
    public class AsynchronousFtpUpLoader
    {  
        // Command line arguments are two strings:
        // 1. The url that is the name of the file being uploaded to the server.
        // 2. The name of the file on the local machine.
        //
        public static void Main(string[] args)
        {
            // Create a Uri instance with the specified URI string.
            // If the URI is not correctly formed, the Uri constructor
            // will throw an exception.
            ManualResetEvent waitObject;
            
            Uri target = new Uri (args[0]);
            string fileName = args[1];
            FtpState state = new FtpState();
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(target);
            request.Method = WebRequestMethods.Ftp.UploadFile;
            
            // This example uses anonymous logon.
            // The request is anonymous by default; the credential does not have to be specified. 
            // The example specifies the credential only to
            // control how actions are logged on the server.
            
            request.Credentials = new NetworkCredential ("anonymous","janeDoe@contoso.com");
            
            // Store the request in the object that we pass into the
            // asynchronous operations.
            state.Request = request;
            state.FileName = fileName;
            
            // Get the event to wait on.
            waitObject = state.OperationComplete;
            
            // Asynchronously get the stream for the file contents.
            request.BeginGetRequestStream(
                new AsyncCallback (EndGetStreamCallback), 
                state
            );
            
            // Block the current thread until all operations are complete.
            waitObject.WaitOne();
            
            // The operations either completed or threw an exception.
            if (state.OperationException != null)
            {
                throw state.OperationException;
            }
            else
            {
                Console.WriteLine("The operation completed - {0}", state.StatusDescription);
            }
        }
        private static void EndGetStreamCallback(IAsyncResult ar)
        {
            FtpState state = (FtpState) ar.AsyncState;
            
            Stream requestStream = null;
            // End the asynchronous call to get the request stream.
            try
            {
                requestStream = state.Request.EndGetRequestStream(ar);
                // Copy the file contents to the request stream.
                const int bufferLength = 2048;
                byte[] buffer = new byte[bufferLength];
                int count = 0;
                int readBytes = 0;
                FileStream stream = File.OpenRead(state.FileName);
                do
                {
                    readBytes = stream.Read(buffer, 0, bufferLength);
                    requestStream.Write(buffer, 0, readBytes);
                    count += readBytes;
                }
                while (readBytes != 0);
                Console.WriteLine ("Writing {0} bytes to the stream.", count);
                // IMPORTANT: Close the request stream before sending the request.
                requestStream.Close();
                // Asynchronously get the response to the upload request.
                state.Request.BeginGetResponse(
                    new AsyncCallback (EndGetResponseCallback), 
                    state
                );
            } 
            // Return exceptions to the main application thread.
            catch (Exception e)
            {
                Console.WriteLine("Could not get the request stream.");
                state.OperationException = e;
                state.OperationComplete.Set();
                return;
            }
           
        }
        
        // The EndGetResponseCallback method  
        // completes a call to BeginGetResponse.
        private static void EndGetResponseCallback(IAsyncResult ar)
        {
            FtpState state = (FtpState) ar.AsyncState;
            FtpWebResponse response = null;
            try 
            {
                response = (FtpWebResponse) state.Request.EndGetResponse(ar);
                response.Close();
                state.StatusDescription = response.StatusDescription;
                // Signal the main application thread that 
                // the operation is complete.
                state.OperationComplete.Set();
            }
            // Return exceptions to the main application thread.
            catch (Exception e)
            {
                Console.WriteLine ("Error getting response.");
                state.OperationException = e;
                state.OperationComplete.Set();
            }
        }
    }
}

Comentarios

Para obtener una instancia de FtpWebRequest, utilice el Create método.To obtain an instance of FtpWebRequest, use the Create method. También puede usar el WebClient clase para cargar y descargar la información de un servidor FTP.You can also use the WebClient class to upload and download information from an FTP server. Con cualquiera de estos enfoques, al especificar un recurso de red que usa el esquema de FTP (por ejemplo, "ftp://contoso.com") la FtpWebRequest clase proporciona la capacidad de interactuar mediante programación con servidores FTP.Using either of these approaches, when you specify a network resource that uses the FTP scheme (for example, "ftp://contoso.com") the FtpWebRequest class provides the ability to programmatically interact with FTP servers.

El URI puede ser relativa o absoluta.The URI may be relative or absolute. Si el identificador URI tiene el formato "ftp://contoso.com/%2fpath" (% 2f es el carácter de escape '/'), a continuación, el URI es absoluto y el directorio actual es /path.If the URI is of the form "ftp://contoso.com/%2fpath" (%2f is an escaped '/'), then the URI is absolute, and the current directory is /path. Si, sin embargo, el identificador URI tiene el formato "ftp://contoso.com/path", en primer lugar .NET Framework inicia sesión en el servidor FTP (con el nombre de usuario y la contraseña establecida por el Credentials propiedad), el directorio actual se establece en <UserLoginDirectory>/path.If, however, the URI is of the form "ftp://contoso.com/path", first the .NET Framework logs into the FTP server (using the user name and password set by the Credentials property), then the current directory is set to <UserLoginDirectory>/path.

Debe tener un nombre de usuario y contraseña para el servidor o el servidor debe permitir el inicio de sesión anónimo.You must have a valid user name and password for the server or the server must allow anonymous logon. Puede especificar las credenciales usadas para conectarse al servidor estableciendo el Credentials propiedad, o bien puede incluirlas en el UserInfo parte del URI pasado a la Create método.You can specify the credentials used to connect to the server by setting the Credentials property or you can include them in the UserInfo portion of the URI passed to the Create method. Si incluye UserInfo información en el URI, el Credentials propiedad está establecida en una nueva credencial de red con la información de nombre y la contraseña del usuario especificado.If you include UserInfo information in the URI, the Credentials property is set to a new network credential with the specified user name and password information.

Precaución

A menos que el EnableSsl propiedad es true, todos los datos y comandos, incluida la información de nombre y la contraseña de usuario, se envían al servidor en texto no cifrado.Unless the EnableSsl property is true, all data and commands, including your user name and password information, are sent to the server in clear text. Cualquiera que controle el tráfico de red puede ver sus credenciales y utilizarlas para conectarse al servidor.Anyone monitoring network traffic can view your credentials and use them to connect to the server. Si se conecta a un servidor FTP que requiere credenciales y admite la capa de Sockets seguros (SSL), debe establecer EnableSsl a true.If you are connecting to an FTP server that requires credentials and supports Secure Sockets Layer (SSL), you should set EnableSsl to true.

Debe tener WebPermission para acceder al recurso FTP; en caso contrario, un SecurityException es una excepción.You must have WebPermission to access the FTP resource; otherwise, a SecurityException exception is thrown.

Especifique el comando FTP para enviar al servidor estableciendo el Method propiedad a un valor definido en el WebRequestMethods.Ftp estructura.Specify the FTP command to send to the server by setting the Method property to a value defined in the WebRequestMethods.Ftp structure. Para transmitir datos de texto, cambie el UseBinary propiedad desde su valor predeterminado (true) a false.To transmit text data, change the UseBinary property from its default value (true) to false. Para obtener detalles y las restricciones, vea Method.For details and restrictions, see Method.

Cuando se usa un FtpWebRequest objeto que se va a cargar un archivo en un servidor, debe escribir el contenido del archivo en la secuencia de solicitud obtenida mediante una llamada a la GetRequestStream método o sus equivalentes asincrónicos, el BeginGetRequestStream y EndGetRequestStream métodos.When using an FtpWebRequest object to upload a file to a server, you must write the file content to the request stream obtained by calling the GetRequestStream method or its asynchronous counterparts, the BeginGetRequestStream and EndGetRequestStream methods. Debe escribir en el flujo y cerrar la secuencia antes de enviar la solicitud.You must write to the stream and close the stream before sending the request.

Las solicitudes se envían al servidor mediante una llamada a la GetResponse método o sus equivalentes asincrónicos, el BeginGetResponse y EndGetResponse métodos.Requests are sent to the server by calling the GetResponse method or its asynchronous counterparts, the BeginGetResponse and EndGetResponse methods. Cuando se complete la operación solicitada, un FtpWebResponse se devuelve el objeto.When the requested operation completes, an FtpWebResponse object is returned. La FtpWebResponse objeto proporciona el estado de la operación y los datos descargados desde el servidor.The FtpWebResponse object provides the status of the operation and any data downloaded from the server.

Puede establecer un valor de tiempo de espera para leer o escribir en el servidor mediante el uso de la ReadWriteTimeout propiedad.You can set a time-out value for reading or writing to the server by using the ReadWriteTimeout property. Si se supera el tiempo de espera, el método que realiza la llamada inicia una WebException con WebExceptionStatus establecido en Timeout.If the time-out period is exceeded, the calling method throws a WebException with WebExceptionStatus set to Timeout.

Al descargar un archivo desde un servidor FTP, si el comando se realizó correctamente, el contenido del archivo solicitado está disponible en la secuencia del objeto de respuesta.When downloading a file from an FTP server, if the command was successful, the contents of the requested file are available in the response object's stream. Puede tener acceso a esta secuencia mediante una llamada a la GetResponseStream método.You can access this stream by calling the GetResponseStream method. Para obtener más información, vea FtpWebResponse.For more information, see FtpWebResponse.

Si el Proxy propiedad está establecida, directamente o en un archivo de configuración, las comunicaciones con el servidor FTP se realizan a través del proxy especificado.If the Proxy property is set, either directly or in a configuration file, communications with the FTP server are made through the specified proxy. Si el proxy especificado es un proxy HTTP, solo el DownloadFile, ListDirectory, y ListDirectoryDetails se admiten los comandos.If the specified proxy is an HTTP proxy, only the DownloadFile, ListDirectory, and ListDirectoryDetails commands are supported.

Se almacena en caché solo descargan contenido binario; es decir, el contenido recibido utilizando el DownloadFile comando con el UseBinary propiedad establecida en true.Only downloaded binary content is cached; that is, content received using the DownloadFile command with the UseBinary property set to true.

Varios FtpWebRequests reutilizar las conexiones existentes, si es posible.Multiple FtpWebRequests reuse existing connections, if possible.

Para obtener más información sobre el protocolo FTP, consulte RFC 959: File Transfer Protocol.For more information about the FTP protocol, see RFC 959: File Transfer Protocol.

Propiedades

AuthenticationLevel AuthenticationLevel AuthenticationLevel AuthenticationLevel

Obtiene o establece valores que indican el nivel de autenticación y de suplantación utilizados para esta solicitud. Gets or sets values indicating the level of authentication and impersonation used for this request.

(Inherited from WebRequest)
CachePolicy CachePolicy CachePolicy CachePolicy

Obtiene o establece la directiva de caché para esta solicitud. Gets or sets the cache policy for this request.

(Inherited from WebRequest)
ClientCertificates ClientCertificates ClientCertificates ClientCertificates

Obtiene o establece los certificados usados para establecer una conexión cifrada con el servidor FTP. Gets or sets the certificates used for establishing an encrypted connection to the FTP server.

ConnectionGroupName ConnectionGroupName ConnectionGroupName ConnectionGroupName

Obtiene o establece el nombre del grupo de conexiones que contiene el punto de servicio usado para enviar la solicitud actual. Gets or sets the name of the connection group that contains the service point used to send the current request.

ContentLength ContentLength ContentLength ContentLength

Obtiene o establece un valor omitido por la clase FtpWebRequest. Gets or sets a value that is ignored by the FtpWebRequest class.

ContentOffset ContentOffset ContentOffset ContentOffset

Obtiene o establece un desplazamiento de bytes en el archivo que descargará esta solicitud. Gets or sets a byte offset into the file being downloaded by this request.

ContentType ContentType ContentType ContentType

Siempre inicia una NotSupportedException. Always throws a NotSupportedException.

CreatorInstance CreatorInstance CreatorInstance CreatorInstance

Cuando se reemplaza en una clase descendiente, obtiene el objeto generador derivado de la clase IWebRequestCreate usada para crear la instancia de WebRequest para efectuar la solicitud al URI especificado. When overridden in a descendant class, gets the factory object derived from the IWebRequestCreate class used to create the WebRequest instantiated for making the request to the specified URI.

(Inherited from WebRequest)
Credentials Credentials Credentials Credentials

Obtiene o establece las credenciales usadas para la comunicación con el servidor FTP. Gets or sets the credentials used to communicate with the FTP server.

DefaultCachePolicy DefaultCachePolicy DefaultCachePolicy DefaultCachePolicy

Define la directiva de caché predeterminada para todas las solicitudes FTP. Defines the default cache policy for all FTP requests.

EnableSsl EnableSsl EnableSsl EnableSsl

Obtiene o establece un valor Boolean que especifica que se debe usar una conexión SSL. Gets or sets a Boolean that specifies that an SSL connection should be used.

Headers Headers Headers Headers

Obtiene un objeto WebHeaderCollection vacío. Gets an empty WebHeaderCollection object.

ImpersonationLevel ImpersonationLevel ImpersonationLevel ImpersonationLevel

Obtiene o establece el nivel de suplantación para la solicitud actual. Gets or sets the impersonation level for the current request.

(Inherited from WebRequest)
KeepAlive KeepAlive KeepAlive KeepAlive

Obtiene o establece un valor Boolean que especifica si la conexión de control al servidor FTP se cierra después de que la solicitud se complete. Gets or sets a Boolean value that specifies whether the control connection to the FTP server is closed after the request completes.

Method Method Method Method

Obtiene o establece el comando que se envía al servidor FTP. Gets or sets the command to send to the FTP server.

PreAuthenticate PreAuthenticate PreAuthenticate PreAuthenticate

Siempre inicia una NotSupportedException. Always throws a NotSupportedException.

Proxy Proxy Proxy Proxy

Obtiene o establece el servidor proxy que se usa para la comunicación con el servidor FTP. Gets or sets the proxy used to communicate with the FTP server.

ReadWriteTimeout ReadWriteTimeout ReadWriteTimeout ReadWriteTimeout

Obtiene o establece un tiempo de espera para una operación de lectura o escritura en una secuencia. Gets or sets a time-out when reading from or writing to a stream.

RenameTo RenameTo RenameTo RenameTo

Obtiene o establece el nuevo nombre de un archivo al que se cambia el nombre. Gets or sets the new name of a file being renamed.

RequestUri RequestUri RequestUri RequestUri

Obtiene el identificador URI solicitado por esta instancia. Gets the URI requested by this instance.

ServicePoint ServicePoint ServicePoint ServicePoint

Obtiene el objeto ServicePoint usado para conectarse al servidor FTP. Gets the ServicePoint object used to connect to the FTP server.

Timeout Timeout Timeout Timeout

Obtiene o establece el número de milisegundos de espera para una solicitud. Gets or sets the number of milliseconds to wait for a request.

UseBinary UseBinary UseBinary UseBinary

Obtiene o establece un valor Boolean que especifica el tipo de datos para las transferencias de archivos. Gets or sets a Boolean value that specifies the data type for file transfers.

UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials

Siempre inicia una NotSupportedException. Always throws a NotSupportedException.

UsePassive UsePassive UsePassive UsePassive

Obtiene o establece el comportamiento del proceso de transferencia de datos de una aplicación cliente. Gets or sets the behavior of a client application's data transfer process.

Métodos

Abort() Abort() Abort() Abort()

Finaliza una operación FTP asincrónica. Terminates an asynchronous FTP operation.

BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object)

Empieza a abrir para escritura de forma asincrónica la secuencia de contenido de una solicitud. Begins asynchronously opening a request's content stream for writing.

BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object)

Empieza enviando una solicitud y recibiendo de forma asincrónica una respuesta de un servidor FTP. Begins sending a request and receiving a response from an FTP server asynchronously.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

Crea un objeto que contiene toda la información relevante necesaria para generar un proxy utilizado para comunicarse con un objeto remoto. Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult)

Finaliza una operación asincrónica pendiente iniciada con BeginGetRequestStream(AsyncCallback, Object). Ends a pending asynchronous operation started with BeginGetRequestStream(AsyncCallback, Object).

EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult)

Finaliza una operación asincrónica pendiente iniciada con BeginGetResponse(AsyncCallback, Object). Ends a pending asynchronous operation started with BeginGetResponse(AsyncCallback, Object).

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determina si el objeto especificado es igual al objeto actual. Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Sirve como la función hash predeterminada. Serves as the default hash function.

(Inherited from Object)
GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

Recupera el objeto de servicio de duración actual que controla la directiva de duración de esta instancia. Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

Llena SerializationInfo con los datos necesarios para serializar el objeto de destino. Populates a SerializationInfo with the data needed to serialize the target object.

(Inherited from WebRequest)
GetRequestStream() GetRequestStream() GetRequestStream() GetRequestStream()

Recupera la secuencia usada para cargar datos a un servidor FTP. Retrieves the stream used to upload data to an FTP server.

GetRequestStreamAsync() GetRequestStreamAsync() GetRequestStreamAsync() GetRequestStreamAsync()

Cuando se invalida en una clase descendiente, devuelve un objeto Stream para escribir datos en el recurso de Internet como una operación asincrónica. When overridden in a descendant class, returns a Stream for writing data to the Internet resource as an asynchronous operation.

(Inherited from WebRequest)
GetResponse() GetResponse() GetResponse() GetResponse()

Devuelve la respuesta del servidor FTP. Returns the FTP server response.

GetResponseAsync() GetResponseAsync() GetResponseAsync() GetResponseAsync()

Cuando se invalida en una clase descendiente, devuelve una respuesta a una solicitud de Internet como una operación asincrónica. When overridden in a descendant class, returns a response to an Internet request as an asynchronous operation.

(Inherited from WebRequest)
GetType() GetType() GetType() GetType()

Obtiene el Type de la instancia actual. Gets the Type of the current instance.

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

Obtiene un objeto de servicio de duración para controlar la directiva de duración de esta instancia. Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Crea una copia superficial del Object actual. Creates a shallow copy of the current Object.

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

Crea una copia superficial del objeto MarshalByRefObject actual. Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

Devuelve una cadena que representa el objeto actual. Returns a string that represents the current object.

(Inherited from Object)

Implementaciones de interfaz explícitas

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

Cuando se reemplaza en una clase descendiente, rellena una instancia de SerializationInfo con los datos necesarios para serializar el objeto WebRequest. When overridden in a descendant class, populates a SerializationInfo instance with the data needed to serialize the WebRequest.

(Inherited from WebRequest)

Seguridad

WebPermission
Para acceder al recurso al que hace referencia esta solicitud. for accessing the resource referenced by this request. Enumeración asociada: Connect. Associated enumeration: Connect.

Se aplica a

Consultar también