C# download file from url - know
C# download file from url - apologise
WebClient.DownloadFile Method
Downloads the resource with the specified URI to a local file.
Parameters
- address
- String
The URI from which to download data.
- fileName
- String
The name of the local file that is to receive the data.
Exceptions
The URI formed by combining BaseAddress and is invalid.
-or-
is or Empty.
-or-
The file does not exist.
-or- An error occurred while downloading data.
Examples
The following code example downloads a file from http://www.contoso.com to the local hard drive.
Remarks
The DownloadFile method downloads to a local file data from the URI specified by in the parameter. This method blocks while downloading the resource. To download a resource and continue executing while waiting for the server's response, use one of the DownloadFileAsync methods.
If the BaseAddress property is not an empty string ("") and does not contain an absolute URI, must be a relative URI that is combined with BaseAddress to form the absolute URI of the requested data. If the QueryString property is not an empty string, it is appended to .
This method uses the RETR command to download an FTP resource. For an HTTP resource, the GET method is used.
When using this method in a middle tier application, such as an ASP.NET page, you will receive an error if the account under which the application executes does not have permission to access the file.

-