Rebex File Transfer Pack

SFTP, FTP, FTP/SSL and File Server for .NET

Download 30-day free trial Buy from $699

Save 33% by buying bundle (Purchased individually: $1047)

More .NET libraries

Back to feature list...

File Transfer Client: Overview

Universal FTP/SFTP client overview 

  • One class for SFTP and FTP/SSL protocols

    No need to write similar code twice code when you want your application to use both FTP and SFTP.

  • Easy to connect to both SFTP and FTP servers

    SFTP, plain unencrypted FTP, implicit or explicit FTP/SSL - all connection methods are handled. All common FTP and SFTP authentication methods are included as well.

    See details on connecting and authentication with FileTransferClient.

  • Write multiprotocol code using IFtp interface

    File upload, download, directory creating and more. All what's common for FTP and SFTP is accessible using an IFtp interface implementation.

  • Access to underlying SFTP/FTP object when needed

    Want to do FTP server-to-server transfer? Want to reuse and existing SSH session for password changing? Underlying object are easily accessible.

See it in action

// get connected and authenticated FTP or SFTP object
var client = new FileTransferClient();

// client.Connect(hostname, FileTransferMode.Ftp) // FTP
// client.Connect(hostname, FileTransferMode.FtpSslImplicit) // FTP/SSL
client.Connect(hostname, FileTransferMode.Sftp); // connect to SFTP

// the remaining code works with both FTP and SFTP sessions

// authenticate
client.Login(username, password);

// do some work
client.ChangeDirectory(targetDirectory);
client.PutFile(@"C:\MyData\file.txt", "file.txt");

// say goodbye
client.Disconnect();
' get connected and authenticated FTP or SFTP object
Dim client = New FileTransferClient()

' client.Connect(hostname, FileTransferMode.Ftp) ' FTP
' client.Connect(hostname, FileTransferMode.FtpSslImplicit) ' FTP/SSL
client.Connect(hostname, FileTransferMode.Sftp) ' connect to SFTP

' the remaining code works with both FTP and SFTP sessions

' authenticate
client.Login(username, password)

' do some work
client.ChangeDirectory(targetDirectory)
client.PutFile("C:\MyData\file.txt", "file.txt")

' say goodbye
client.Disconnect()

IFtp interface - Protocol agnostic file transfer API 

IFtp interface supports most Ftp and Sftp methods, events and properties. IFtp is implemented in FileTransferClient, Sftp and Ftp classes.

What's included:

For a list of all IFtp methods, events and properties, see IFtp reference guide.
For a details and sample code IFtp see SFTP and FTP/SSL features. Most of them are included in IFtp interface as well.

Working with underlying SFTP/FTP object 

Sometimes you have to use a feature available only in one protocol. You can access underlying Sftp or Ftp object using the FileTransferClient.Inner property.

var client = new FileTransferClient();
client.Connect(hostname, FileTransferMode.Ftp);

// send the custom FTP command using the inner Ftp object
// "FEAT" returns a list of server features
Ftp ftp = client.Inner as Ftp;
ftp.SendCommand("FEAT");

// read the response
var response = ftp.ReadResponse();
Console.WriteLine(response.Raw);
Dim client = New FileTransferClient()
client.Connect(hostname, FileTransferMode.Ftp)

' send the custom FTP command using the inner Ftp object
' "FEAT" returns a list of server features
Dim ftp As Ftp = TryCast(client.Inner, Ftp)
ftp.SendCommand("FEAT")

' read the response
Dim response = ftp.ReadResponse()
Console.WriteLine(response.Raw)

Back to feature list...