dotnetopenid attribute extensions just not working for me!
- by Rob Ellis
So here's some code on the request:-
IAuthenticationRequest req = openid.CreateRequest(Request.Form["openid_identifier"]);
//add extention requests here
req.AddExtension(new ClaimsRequest
{
Email = DemandLevel.Request,
BirthDate = DemandLevel.Request,
Country = DemandLevel.Request,
FullName = DemandLevel.Request,
Gender = DemandLevel.Request,
Language = DemandLevel.Request,
Nickname = DemandLevel.Request,
PostalCode = DemandLevel.Request,
TimeZone = DemandLevel.Request
}
);
//get the request from openid
return req.RedirectingResponse.AsActionResult();
And here's some on the pickup:-
//get attributes from site
var sreg = response.GetExtension<ClaimsResponse>();
string sreg_email = "Unknown Email";
DateTime sreg_birthdate;
string sreg_birthdateraw;
Gender sreg_gender;
Version sreg_version;
string sreg_timezone;
string sreg_nickname;
string sreg_postalcode;
System.Globalization.CultureInfo sreg_culture;
string sreg_country;
string sreg_fullname;
System.Net.Mail.MailAddress sreg_mailaddress;
string sreg_language;
if (sreg != null)
{
sreg_email = sreg.Email;
sreg_birthdate = sreg.BirthDate.Value;
sreg_birthdateraw = sreg.BirthDateRaw;
sreg_country = sreg.Country;
sreg_culture = sreg.Culture;
sreg_fullname = sreg.FullName;
sreg_gender = sreg.Gender.Value;
sreg_language = sreg.Language;
sreg_mailaddress = sreg.MailAddress;
sreg_nickname = sreg.Nickname;
sreg_postalcode = sreg.PostalCode;
sreg_timezone = sreg.TimeZone;
sreg_version = sreg.Version;
}
But it's all coming back as null no matter which OpenId provider I use...
Am I missing something obvious?
Rob