Downloading pdf file using WebRequests

后端 未结 4 1356
夕颜
夕颜 2020-12-15 09:20

I\'m trying to download a number of pdf files automagically given a list of urls.

Here\'s the code I have:

HttpWebRequest request = (HttpWebRequest)W         


        
4条回答
  •  [愿得一人]
    2020-12-15 09:46

    Your question asks about WebClient but your code shows you using Raw HTTP Requests & Resposnses.

    Why don't you actually use the System.Net.WebClient ?

    using(System.Net.WebClient wc = new WebClient()) 
    {
        wc.DownloadFile("http://www.site.com/file.pdf",  "C:\\Temp\\File.pdf");
    }
    

提交回复
热议问题