Domanda

I want to code a simple file downloader in C#. I want to know how it works? eg. If I give it a URL, what will it do? I have a very rough idea about it.

  1. It will send a HTTP request.
  2. The server will reply and send the file.
  3. The downloader will get the file and store it in hard drive.

This is my first time coding on web technology. So I hardly have any idea.
Can anybody please explain me the steps?

È stato utile?

Soluzione

A snippet to get you started:

using(var wc=new WebClient())
{
    wc.DownloadFile("http://some/internet/resource",@"c:\some\local\filename");
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top