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?

有帮助吗?

解决方案

A snippet to get you started:

using(var wc=new WebClient())
{
    wc.DownloadFile("http://some/internet/resource",@"c:\some\local\filename");
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top