Download a Web Pages Contents and Save them to a File in VB.NET

Pramod Kumar Singh

Version Compatibility: Visual Basic.NET

More information:
This application contains a Form and a Class module . From the Form, a thread is created which executes the procedure to handle the NET download. This application can be enhance dto do more downloads by creating more threads.

Originally developed for beta versions;verified to work on VB.NET Version 1.0 03/26/02. There is some weirdness: to select the directory you want to download the web page to, you have to select an existing file in that directory. That file will not be overwritten.

The HTTP protocol accounts for a large share of all traffic on the Internet; and the .NET frameworks provide robust support for the HTTP protocol with the HttpWebRequest and HttpWebResponse classes. These classes are the WebRequest and WebResponse derived classes returned whenever a URI beginning with "http" or "https" is presented to the Create method on the WebRequestFactory. In most cases, the WebRequest and WebResponse classes will provide all that is necessary to make the request, but when access to HTTP-specific features is required, the request or response can be typecast to HttpWebRequest or HttpWebResponse.

The HttpWebRequest and HttpWebResponse classes encapsulate a standard HTTP request and response transaction, and provide access to common HTTP headers through properties. These classes also support most of the HTTP 1.1 protocol features, including pipelining, chunking, authentication, pre-authentication, encryption, proxy support, server certificate validation, connection management, and HTTP extensions. Custom headers and headers not provided through properties can be accessed by storing them in the Headers property.

Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.