Download a Web Page using the WebClient
(Page 1 of 4 )
Users of the .NET framework can now display a web page and its source code at the same time. This functionality has been available for a while in VB6. In the .NET framework, it belongs to the WebClient class and the WebClient Control. Keep reading to learn how to use these handy tools.
Introduction
In the past you might have used the Microsoft Internet Controls (SHDOCVW.dll) and the Microsoft Internet Transfer Control 6.0 (SP4) in VB6 applications. The WebBrowser Control (SHDOCVW.dll) gives you the ability to display a web page in a Visual Basic Application. The Inet Control (Internet Transfer Control) gives you the ability to download and upload files to URLs. Please review the tutorial on the WebBrowser control used for downloading web pages. Given the URL, the two controls together can show the web page and its source at the same time.
This basic tutorial shows how the same functionality is now available to .NET framework users by calling the methods and properties of the WebClient class, which belongs to the System.NET Namespace. In order to use this class, the Microsoft Visual Basic 2005 Express Edition (also Visual Studio 2005) can be used. The program can be downloaded from the Microsoft website. This beginners oriented tutorial also shows how to use the WebClient Control as well.
You can find the WebClient in the .NET Framework Components page in the Choose Toolbox Items pop-up when you access it using the Tools-->Choose Toolbox Items... hyperlink. You can also find the WebBrowser Control in the same folder. You can also access these controls in the same exact manner in Visual Studio 2005, and the Visual Web Developer 2005 Express Edition.
Next: Creating a Windows project to use the WebClient Class >>
More Code Examples Articles
More By Jayaram Krishnaswamy