string DownloadSync(string url, string directory, string fileName)
{
var client = new WebClient();
ServicePointManager.DefaultConnectionLimit = 2;
string status = "started";
Console.Write("Downloading - " + fileName);
try
{
client.DownloadFile(new Uri(@url), @directory + @"\" + @fileName);
status = "Successfully downloaded";
}
catch (WebException e)
{
status = e.Status.ToString();
}
Console.WriteLine(" >>>>> Downloaded - ");
return status;
}
Sync Download Of A File Dot Net (.Net)
