我试图建立DotNetOpenAuth使用OpenIdAjaxTextBox,但我有两个问题
我希望能够得到用户的电子邮件地址,我认为这是在的loggedIn事件做了(是吗?),但该事件不会被调用,我已经尝试设置一个断点,但我从来没有得到它。
当我在OpenIdAjaxTextBox的OpenID提供商(可以说是Gmail)型,我得到的文本框登录按钮,所以我点击它,一个新的窗口弹出,里显示Gmail的登录表单但在那之后我输入我的用户名和密码,点击登录该弹出窗口刷新并在弹出的窗口中我自己的网站负载,我希望在弹出窗口关闭后,我登录不重定向我到我的网站。
这里是我使用的代码
<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty"
TagPrefix="openid" %>
<openid:OpenIdAjaxTextBox ID="OpenIdAjaxTextBox1" runat="server"
OnLoggingIn="openIdtxtbx_LoggingIn"
OnLoggedIn="openIdtxtbx_LoggedIn"
OnClientAssertionReceived="onauthenticated(sender)"
OnUnconfirmedPositiveAssertion="openIdtxtbx_UnconfirmedPositiveAssertion" />
Protected Sub openIdtxtbx_LoggedIn(ByVal sender As Object, ByVal e As OpenIdEventArgs)
' Do something here
Dim claimedId As String = e.Response.Status
End Sub
Protected Sub openIdtxtbx_LoggingIn(ByVal sender As Object, ByVal e As OpenIdEventArgs)
' Retrieve the email address of the user
Dim c As New ClaimsRequest
c.Email = DemandLevel.Require
e.Request.AddExtension(c)
End Sub
Protected Sub openIdtxtbx_UnconfirmedPositiveAssertion(ByVal sender As Object, ByVal e As OpenIdEventArgs)
' This is where we register extensions that we want to have available in javascript
' on the browser.
OpenIdAjaxTextBox1.RegisterClientScriptExtension(Of ClaimsResponse)("sreg")
End Sub