Thursday, July 5, 2007

Download File from Internet using .NET

The WebClient class provides common methods for sending data to and receiving data from any local, intranet, or internet resource identified by a URI.
Namespace: System.Net
Assembly: System (in system.dll)

The DownloadFile method of this class downloads data from a resource to a local file.


WebClient client = new WebClient()
client.DownloadFile(source, destination);

source -
destination - C:\GooglePageRank.xls

Note: By default, the .NET Framework supports URIs that begin with http:, https:, ftp:, and file: scheme identifiers.

No comments: