The .NET framework does not come with support for FTP, so I rolled my own.
FtpLib is a .NET library for doing FTP. Three characteristics:
Here's an example of using it to upload a file:
using Jelovic.FtpLib;
... using (InternetAccess internetAccess = new InternetAccess ()) { using (FtpConnection connection = internetAccess.FtpConnect (serverAddress, port, username, password, true)) { connection.UploadFile ("c:/tmp/myfile.txt", "/myfile.txt", TransferType.Binary, CachingFlags.None); } }
The InternetAccess class is used to define how you want to access the Internet: directly, using the default proxy, using the proxy you specify, etc.
The FtpConnection represents a connection to a FTP server. It has methods for uploading and downloading files, reading directories, etc.
If you just want to use the library, the most convenient thing is just to get the DLL here.
If you need to make any modification, the download the source.
I'm distributing it under the FreeBSD license.
Content of this site is © Dejan Jelovic. All rights reserved.