WebClient 403 Forbidden

后端 未结 8 1623
失恋的感觉
失恋的感觉 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:04

    I get a 403 in IE, I guess you need to be logged in to retrieve the resource. Your browser may have the credentials cached but your app isn't designed to log you in. Or are you logged in to Google in your browser - try logging out and see if you still have access....

    0 讨论(0)
  • 2020-12-17 11:07

    Just add a simple line before you make your download:

    string url = ... 
    string fileName = ...
    
    WebClient wb = new WebClient();
    wb.Headers.Add("User-Agent: Other");   //that is the simple line!
    wb.DownloadFile(url, fileName);
    

    That's it.

    0 讨论(0)
提交回复
热议问题