WebClient 403 Forbidden

后端 未结 8 1626
失恋的感觉
失恋的感觉 2020-12-17 10:30

I can download this by hand in IE.

http://scholar.google.com/scholar.ris?q=info:j8ymU9rzMsEJ:scholar.google.com/&output=citation&hl=zh-CN&as_sdt=2000&

8条回答
  •  伪装坚强ぢ
    2020-12-17 11:01

    You need to set appropriate http headers before calling your DownloadFile method.

    WebClient webClient = new WebClient();
    webClient.Headers.Add("???", "???");
    webClient.Headers.Add("???", "???");
    webClient.Headers.Add("???", "???");
    webClient.DownloadFile(address, filename);
    

    To put correct values instead of these question marks might be tricky. You will need to download Fiddler or some other program or webbrowser extension to reveal what http headers are being sent to Google by your webbrowser and basically replicate the same request in your program.

提交回复
热议问题