views:

76

answers:

1

I'm writing a google appengine application, which stores data and has a web front end. I want to be ableto pull down this data in a C# program. This means I need to authenticate with the site (users must be logged in to view the data). How can I authenticate like this? I tried setting credentials on the WebClient but I keep getting the google login page.

WebClient client = new WebClient();
client.Credentials = new NetworkCredential("username", "password");
//should it be [email protected] ??

client.BaseAddress = "http://nosoperor-internal.appspot.com";

String s = client.DownloadString("/bank");
//s now contains the google login page, unfortunately
+2  A: 

AFAIK, you need to probably use Google Data protocols and account APIs to authenticate.

Edit: I would download the .Net client library and try the examples in there. This is a copy paste from the docs:

Service service = new Service("cl", "exampleCo-exampleApp-1"));
// Set your credentials:
service.setUserCredentials("[email protected]", "mypassword");
Maxwell Troy Milton King
hmm, that looks like it might be the answer, but I'm not sure. Any more details on this?
Martin
I think that you specifically want to look at the ClientLogin section: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
Adam Crossland
Thing is, I don't think my app counts as a service, presumably I would need to rewrite the application to deal with automated logins like this? I don't really know enough about web programming to be able to do that
Martin