2010-02-21 80 views
4

我正在写一个谷歌appengine应用程序,其中存储数据和Web前端。我希望能够在C#程序中下拉这些数据。这意味着我需要对网站进行身份验证(用户必须登录才能查看数据)。我如何进行身份验证?我尝试在WebClient上设置凭据,但我一直在获取Google登录页面。与来自C的谷歌appengine互动#

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 
+0

什么样的登陆计划的网站是否聘用? HTTP基本/摘要,表单+ cookie? – 2010-02-21 21:39:24

+0

我不知道,无论默认为appengine – Martin 2010-02-21 22:27:37

回答

2

据我所知,你需要可能使用Google Data protocolsaccount APIs进行身份验证。

编辑:我会download the .Net client library并尝试在那里的例子。这是从一个docs复制粘贴:

Service service = new Service("cl", "exampleCo-exampleApp-1")); 
// Set your credentials: 
service.setUserCredentials("[email protected]", "mypassword"); 
+0

hmm,这看起来可能是答案,但我不知道。关于这个的更多细节? – Martin 2010-02-21 22:46:43

+0

我认为你特别想看看ClientLogin部分:http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html – 2010-02-22 01:27:04

+0

事情是,我认为我的应用程序不算作服务,据推测我需要重写应用程序来处理像这样的自动登录?我对网络编程知之甚少,无法做到这一点 – Martin 2010-02-23 11:16:52