How to download a file from a URL in C#?

前端 未结 11 1308
清歌不尽
清歌不尽 2020-11-22 15:13

What is a simple way of downloading a file from a URL path?

11条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 15:20

    using System.Net;
    
    WebClient webClient = new WebClient();
    webClient.DownloadFile("http://mysite.com/myfile.txt", @"c:\myfile.txt");
    

提交回复
热议问题