function for download file.
///
/// Download a file from specified URL and save it on local machine.
///
/// URL from where you want to download file.
public void DownloadFile(string URL, string LocalPath)
{
try
{
System.Net.WebClient WebClient = new System.Net.WebClient();
// Downloads the resource with the specified URI to a local file.
WebClient.DownloadFile(URL, LocalPath);
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e.ToString());
}
}
Call above function//Calling function:
DownloadFile("http://www.Website.com/demo.rar", @"C:\download\file.zip");