Provides an FTP-specific implementation of the WebRequest class.

      Syntax

      public class FtpWebRequest : WebRequest

      Examples

      Shows how to use the FtpWebRequest class.

      using System;
      using System.IO;
      using System.Net;
      
      ...
      
      // Register FtpWebRequest for the specified schema.
      WebRequest.RegisterPrefix("ftp://", ComponentPro.Net.FtpWebRequest.Creator);
      
      Console.WriteLine("Sending request...");
      
      // Create a WebRequest for the specified URL. 
      WebRequest request = WebRequest.Create("ftp://ftp.example.net/pub/myfile.zip");
      
      // Send the WebRequest and waits for a response.
      WebResponse response = request.GetResponse();
      
      // Get remote file stream for downloading.
      Stream remoteFileStream = response.GetResponseStream();
      
      Stream localFileStream = File.Create("myfile.zip");
      
      // Create a new buffer to download. 
      byte[] buffer = new byte[1024];
      int n;
      do
      {
          // Read data from the remote file stream. 
          n = remoteFileStream.Read(buffer, 0, buffer.Length);
          // Write to the local file stream. 
          localFileStream.Write(buffer, 0, n);
      } while (n > 0);
      
      Console.WriteLine("Response Received.");
      
      localFileStream.Close();
      
      // Release the resources of the response.
      remoteFileStream.Close();

      Inheritance Hierarchy

               ComponentPro.Net.ComponentPro.Net.FtpWebRequest

      Framework

      .NET Compact Framework.NET Compact Framework

      Supported version: 2.0, 3.5, and 3.9
      Assembly: ComponentPro.Ftp.CF (in ComponentPro.Ftp.CF.dll)

      .NET Framework.NET Framework

      Supported version: 2.0, 3.0, 3.5, 4.0, 4.5.x, 4.6.x and later
      Assembly: ComponentPro.Ftp (in ComponentPro.Ftp.dll)

      Xamarin AndroidXamarin Android

      Supported version: 2.3 and later
      Assembly: ComponentPro.Ftp.Android (in ComponentPro.Ftp.Android.dll)

      Xamarin MacXamarin Mac

      Supported version: 2.0.x and later
      Assembly: ComponentPro.Ftp.Mac (in ComponentPro.Ftp.Mac.dll)

      Xamarin iOSXamarin iOS

      Supported version: 5.1.x and later
      Assembly: ComponentPro.Ftp.iOS (in ComponentPro.Ftp.iOS.dll)

      See Also