How to download a file from a website in C#

S3THST4 picture S3THST4 · Feb 8, 2009 · Viewed 168.7k times · Source

Is it possible to download a file from a website in Windows Application form and put it into a certain directory?

Answer

Christian C. Salvadó picture Christian C. Salvadó · Feb 8, 2009

With the WebClient class:

using System.Net;
//...
WebClient Client = new WebClient ();
Client.DownloadFile("http://i.stackoverflow.com/Content/Img/stackoverflow-logo-250.png", @"C:\folder\stackoverflowlogo.png");