C# 关于在某个Google应用程序域上实现Google OpenID的问题
我正在尝试实现一个Google OpenID登录 我有以下问题: 在哪里可以获得行中变量openidurl的值 IAAuthenticationRequest=openid.CreateRequestopenidurl 二,。。如何仅限制某个Google Apps域的登录 代码如下:C# 关于在某个Google应用程序域上实现Google OpenID的问题,c#,asp.net,google-apps,google-openid,C#,Asp.net,Google Apps,Google Openid,我正在尝试实现一个Google OpenID登录 我有以下问题: 在哪里可以获得行中变量openidurl的值 IAAuthenticationRequest=openid.CreateRequestopenidurl 二,。。如何仅限制某个Google Apps域的登录 代码如下: protected void Page_Load(object sender, EventArgs e) { OpenIdRelyingParty openid = new Open
protected void Page_Load(object sender, EventArgs e)
{
OpenIdRelyingParty openid = new OpenIdRelyingParty();
var response = openid.GetResponse();
if (response != null)
{
switch (response.Status)
{
case AuthenticationStatus.Authenticated:
var fetch = response.GetExtension<FetchResponse>();
string email = string.Empty;
if (fetch != null)
{
email = fetch.GetAttributeValue(WellKnownAttributes.Contact.Email);
}
//FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, false);
Session["email"] = email;
Response.Redirect("profile.aspx");
break;
}
}
}
protected void OpenLogin_Click(object src, CommandEventArgs e)
{
string openidurl = "https://www.google.com/accounts/o8/id?id=initial_id"; //auxiliary initial id. ??????
//The Request
using (OpenIdRelyingParty openid = new OpenIdRelyingParty())
{
IAuthenticationRequest request = openid.CreateRequest(openidurl);
var fetch = new FetchRequest();
fetch.Attributes.AddRequired(WellKnownAttributes.Contact.Email);
request.AddExtension(fetch);
// Send your visitor to their Provider for authentication.
request.RedirectToProvider();
}
}
}
提前感谢,这是我第一次使用Google OpenIDs。签出此链接或此StackOverFlow链接我在编写上面的代码时已经签出了这些链接,我正在使用DotNetOpenAuth。不过谢谢你的回复。。。