The FTP classes follow the FtpWebRequest in the full .NET framework. Add a reference to InTheHand.dll and InTheHand.Net.dll to your project and add the following to your code file:-
On startup e.g. in your Form constructor add:-
This allows you to create FtpWebRequests using WebRequestCreate for any url with the ftp:// schema
To download a file you can use code like this:-
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftp://yourserver/path/filename.txt);
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
System.IO.Stream stream = response.GetResponseStream();System.IO.FileStream fileStream = new System.IO.FileStream(“\\Local File Name.txt”, System.IO.FileMode.Create);
The default Method for an FtpWebRequest is RETR (download). To upload a file you would set Method to “STOR” and write the file contents to the stream retrieved from GetRequestStream(). The full list of available methods can be found in InTheHand.Net.WebRequestMethods.Ftp.