Click here to Skip to main content
13,446,366 members (39,373 online)
Click here to Skip to main content
Add your own
alternative version


103 bookmarked
Posted 25 Jun 2008

FTP Client and HttpFileDownloader Components (Controls)

, 25 Jun 2008
Rate this:
Please Sign up or sign in to vote.
FTP client and HttpFileDownloader components (controls).


Once I needed a simple, open source, and robust FTP client to include in my project. To my surprise, I was not able to find one in spite of many FTP clients that were published on various websites including CodeProject. The problem was the quality: the published projects were just demos. There were no quality FTP clients.

According to ratings, the most popular CodeProject FTP client is available here: An FTP client library for .NET 2.0. In spite of numerous fixes, the component did not work as I anticipated. And the major problem is not in the fixes (some of them were quite reasonable) - the problem is in the underlying FtpWebRequest component itself.

The component is designed to operate in stateless mode. One can only guess what the reasons were behind such a “wise” decision. FTP is a connection based protocol, and any attempt to fit a connection based protocol into a connectionless component apparently can not work well, by definition. First, what can we possibly benefit out of relinquishing the control over the connection status? The connection will not go away even if you hide it somewhere - it is the protocol's property, not the component’s. I can only think that the designers of this component intended to keep the component in line with HttpWebRequest. But, the difference is that the HTTP protocol is stateless by nature and FTP is not.

FtpWebRequest problems

So, what is wrong with FtpWebRequest? The main problem is the response time. The connection to the server of any FTP client took about 2.5 seconds. FtpWebRequest consistently showed 13.5 seconds (when connected to the same site). No customer would tolerate an extra 11 seconds delay without reason (440% increase). Apart from that, if you do not explicitly set KeepConnectionAlive to false, the system would not work properly. (It is supposed to be false, by default.)

The solution

Luckily, I found a good solution in the aforementioned article's comments. The solution is edtFTPnet. It is an open source library of the highest quality (believe it or not). The library is designed by Enterprise Distributed Technologies. They also have advanced versions of FTP components (with SSL and other features), but they are not free. The only problem with the open source one is that it lacks multithreading support. But that is not a real problem – a multithreading wrapper can be created for almost anything if you have experience. This component is a multithreading wrapper for edtFTPnet designed as a Windows Forms control, with some minor additions like status bar support and threads handling.

Core features

  • Runs in a separate thread.
  • Ability to cancel the transfer at any time.
  • Progress bar support.
  • Displays estimated time left.
  • Displays transfer speed.

How to use the controls

Copy the root directory (and subdirectories) to any location. Create a new tab in the Visual Studio Toolbox. Register the library with the Visual Studio Toolbox by browsing for FTPLib. You will be able to see the controls on the tab.

Drag the control to your form. Place the progress bar on the form. Select your FtpControl and select your status bar in the ProgrBar control’s properties.

Create a status event by selecting and double clicking StatusUpdateEvent.

The rest is quite clear from the samples.


The second component is a HttpFileDownloader component (control). Both components inherit from the BaseDownloader component.

New version

If a newer version is released, it will be available here.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Australia Australia
No Biography provided

You may also be interested in...


Comments and Discussions

NewsMy vote of 5 Pin
Elmue17-Mar-11 15:20
memberElmue17-Mar-11 15:20 

I did not download your code but your suggestion to use the EDT library instead of Microsoft's Framework safed me a lot of time. Many thanks for your article!

I also published an FTP project Partial FTP Downloader on Codeproject. It uses Wininet.dll for FTP downloads in .NET code and resumes broken downloads.

This week I downloaded the edtFTPnet library (free version) and tested it throughly. It is really very good.
Nevertheless I found 3 bugs in the library but they are not severe. I reported them but did not receive any answer. The edtFTPnet library started 2003 and I suppose that nobody is working anymore on it. But as you have the sourcecode you can fix any bug on your own.

For all those who need to implement FTP into their project, I give here some tipps how to take the decision:

As stated above, FPT built into .NET framework is slow due to a misdesign.

The edtFTPnet library is the best you can get if you need a powerfull FTP client with lots of features.
But the free version does not have Proxy support. (You have to pay a lot of dollars for the Pro version)

Here comes the advantage of using Wininet.dll as in my project:
Wininet.dll is part of Windows and available on all computers.
You don't need any additional libary because Windows already has FTP built in.
It is part of Internet Explorer.
Wininet.dll has only basic funcionality but allows to go through proxy servers.
You don't even have to configure the proxy manually if Internet Explorer is already configured correctly.

(If you are programming in C++ you find a Wininet library in my CabLib project here on Codeproject)

GeneralWindows 7 Pin
vectoraudiouk7-Apr-10 6:50
membervectoraudiouk7-Apr-10 6:50 
GeneralRe: Windows 7 Pin
Mike Russo28-Jun-10 9:09
memberMike Russo28-Jun-10 9:09 
GeneralFtp root folder Pin
SPdo29-Sep-09 19:59
memberSPdo29-Sep-09 19:59 
GeneralRe: Ftp root folder Pin
meocutduoi3-Apr-13 16:30
membermeocutduoi3-Apr-13 16:30 
Generalregistering dll - adding to Toolbox Pin
sanicovan25-May-09 7:02
membersanicovan25-May-09 7:02 
GeneralRe: registering dll - adding to Toolbox Pin
Alex_125-May-09 23:01
memberAlex_125-May-09 23:01 
GeneralRe: registering dll - adding to Toolbox Pin
sanicovan26-May-09 3:05
membersanicovan26-May-09 3:05 
QuestionResuming? Pin
Niklas Henricson6-May-09 3:15
memberNiklas Henricson6-May-09 3:15 
GeneralDownload list of files? [modified] Pin
Amirtich3-May-09 8:37
memberAmirtich3-May-09 8:37 
mnek8421-Apr-09 1:55
membermnek8421-Apr-09 1:55 
GeneralSetLocalFolder not working... Pin
abakshi18-Dec-08 3:03
memberabakshi18-Dec-08 3:03 
Questionencoding? Pin
ParkInSung1-Dec-08 18:15
memberParkInSung1-Dec-08 18:15 
GeneralProblem with edtFTPnet Pin
infoss21-Aug-08 21:49
memberinfoss21-Aug-08 21:49 
GeneralGreat project Pin
hardsoft26-Jun-08 12:34
memberhardsoft26-Jun-08 12:34 
GeneralRe: Great project Pin
Alex_126-Jun-08 16:39
memberAlex_126-Jun-08 16:39 
GeneralGood job Pin
bilo8125-Jun-08 22:18
memberbilo8125-Jun-08 22:18 
GeneralRe: Good job Pin
Alex_126-Jun-08 16:52
memberAlex_126-Jun-08 16:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180314.2 | Last Updated 25 Jun 2008
Article Copyright 2008 by Alex_1
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid