using (var client = new WebClient())
{
client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg");
}
using System;
using System.Net;
using System.IO;
class FileDownloader
{
static void Main()
{
string path = "http://www.educative.io/cdn-cgi/image/f=auto,fit=contain,w=2400/api/edpresso/shot/5224207262154752/image/5022165490991104.png";
using(WebClient client = new WebClient())
{
client.DownloadFile(path,"image.png");
}
if(File.Exists("image.png"))
{
Console.WriteLine("File Downloaded Successfully");
}
else
{
Console.WriteLine("Not able to download the file.");
}
}
}