11.3. Download Data over HTTP or FTP


You need a quick, simple way to download data from the Internet using HTTP or FTP.


Use the methods of the System.Net.WebClient class or the DownloadFile method of the My.Computer.Network class. (Refer to Chapter 5 for more information about the My object.)

How It Works

The .NET Framework provides several mechanisms for transferring data over the Internet. One of the easiest approaches is to use the System.Net.WebClient class. WebClient provides many high-level methods that simplify the transfer of data by specifying the source as a uniform resource identifier (URI); Table 11-2 summarizes them. The URI can specify that a file (file://), FTP (ftp://), HTTP ((http://), or HTTPS (https://) protocol ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.