download file in c# code example
Example 1: how to download file from url using c#
using (var client = new WebClient())
{
client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg");
}
Example 2: c# download file
using System.Net;
using (WebClient web1 = new WebClient())
web1.DownloadFile("URL", "FileName");
}
Example 3: c# download file
string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
using (WebClient myWebClient = new WebClient())
{
myStringWebResource = remoteUri + fileName;
myWebClient.DownloadFile(myStringWebResource, fileName);
}