Chris's coding blog

Streaming binary/text data via the web in C#

May 24, 2007

Download

This rough example was originally intended for auto-update functionality in an application (it downloads the new .exe, runs a bootstrap application that replaces the existing .exe with the new one, and runs it).

The code is a windows forms application that shows 3 ways of performing the download. The first is the built in DownloadFile method in the WebClient class. The 2nd shows streaming HTML from a website into a listbox (you’ll need to add a listbox to the form for this). The 3rd downloads winrar from rarlabs.com and streams the file to disk. The first 2 methods have been commented out.

It includes a progress bar to show the progress, and total bytes expected. The solution is in Visual Studio 2005 format. The application assumes you have a c:\ drive to download onto.

For now it doesn’t deal with different content types, it’s pretty basic.

csharpxml

I'm Chris Small, a software engineer working in London. This is my tech blog. Find out more about me via GithubStackoverflowResume