edtFTPnet/PRO - Secure FTP component for .NET | Free Trial | Pricing

How to transfer files using HTTP/HTTPS

edtFTPnet/PRO now supports the use of HTTP and HTTPS to perform downloads and uploads.

The same API that is used for FTP can be used to download files via HTTP/HTTPS, and to resume file downloads that have been interrupted (only binary mode transfers can be resumed).

Code to perform a download via HTTP/HTTPS is shown below. In this example, the file at the URL

https://www.test.com/public/test/test.zip is to be downloaded into the C:\temp directory:

SecureFTPConnection ftpConnection = new SecureFTPConnection();
// set the host address
ftpConnection.ServerAddress = "https://www.test.com";
// set the protocol to HTTP
ftpConnection.Protocol = FileTransferProtocol.HTTP;
// set binary transfers (this is the default)
ftpConnection.TransferType = FTPTransferType.BINARY;
// connect and change to the correct directory 
ftpConnection.Connect();
ftpConnection.ChangeworkingDirectory("/public/test");
// download the file
ftpConnection.DownloadFile("C:\\temp\\test.zip","test.zip");
ftpConnection.Close();

Note that the ServerAddress can specify the protocol (http or https) as in this example, but it is not required. If the protocol is not specified, http is assumed. A full URL can also be provided as the remote file in the various Download methods, which overrides the ServerAddress setting.