I am using dotnetopenid in my asp.net 2.0 and VS 2005.I have done only this work and a succeful authentication is done by me.I have a login page and after authentication it goes to food.aspx.I only want to display the email address of user on food.aspx after authentication from google.I have done only following work for the openid nothing else please tell me which code i have to write in login.aspx or food.aspx to display the email address of user.
<%@ Register Assembly="DotNetOpenAuth" Namespace="DotNetOpenAuth.OpenId.RelyingParty" TagPrefix="rp" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<rp:OpenIdLogin ID="OID" runat=server Identifier="https://www.google.com/accounts/o8/id" ></rp:OpenIdLogin>
Update I have wrote this code in page load event of login.aspx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As OpenIdEventArgs)
Dim openid As New OpenIdRelyingParty()
Dim request As IAuthenticationRequest = openid.CreateRequest("https://www.google.com/accounts/o8/id")
Dim fetch As New FetchRequest()
fetch.Attributes.AddRequired(WellKnownAttributes.Contact.Email)
request.AddExtension(fetch)
request.RedirectToProvider()
End Sub
And Page Load Evemt of Food.aspx Write the follwoing code
Dim openid As OpenIdRelyingParty = New OpenIdRelyingParty
Dim response = openid.GetResponse
If (Not (response) Is Nothing) Then
Select Case (response.Status)
Case AuthenticationStatus.Authenticated
Dim fetch = response.GetExtension
Dim email As String = String.Empty
If (Not (fetch) Is Nothing) Then
email = fetch.GetAttributeValue(WellKnownAttributes.Contact.Email)
End If
FormsAuthentication.RedirectFromLoginPage(response.ClaimedIdentifier, False)
End Select
End If
But still getting error of in login.aspx page load event in this line
fetch.Attributes.AddRequired(WellKnownAttributes.Contact.Email)
Error is
AddRequired is not a member of System.Collections.ObjectModel.KeyedCollection
(Of DotNetOpenAuth.OpenId.Extensions.AttributeExchange.AttributeRequest
what can i do for this