[Sample Of Sep 23rd] How to create a simple web downloader


Homepage image
RSS Feed

Sample Download :  http://code.msdn.microsoft.com/Show-progress-in-f66dfe56

The sample demonstrates how to show progress during the download.

The class System.Net.WebClient has a DownloadProgressChanged event, and you can register this event to show the progress. But this class does not support Pause/Resume.

The class HttpDownloadClient in this sample could be used to download data through internet and supports following features:

1. Set the buffer and cache size.

2. Download a specified block data of the whole file.

3. Start, Pause, Resume and Cancel a download. 

4. Supply the file size, download speed and used time.

5. Expose the events StatusChanged, DownloadProgressChanged and DownloadCompleted.

NOTE: To enable the Feature2 and Feature3, the server must support the http "Accept-Ranges" header.


imageYou can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.

Comments (0)

Skip to main content