tags:

views:

92

answers:

2

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&oe=GB&ct=citation&cd=0

But, using follow code

WebClient client = new WebClient(); client.DownloadFile(address, filename);

Show Exception: 403 Forbidden

What's wrong? How can I do that?

others

http://scholar.google.com/scholar.ris?q=info:sskrpr5jlLwJ:scholar.google.com/&output=citation&hl=zh-CN&as_sdt=2000&oe=GB&ct=citation&cd=1

+1  A: 

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....

stupid-phil
Begtostudy
I'd take a look at this project http://desktopgooglereader.codeplex.com/where it looks like they've solved this problem including recent changes by Google
stupid-phil
A: 

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.

lubos hasko
Begtostudy