1
Andrew Arnott在这里有一篇关于如何从OpenId proivder中提取属性交换扩展数据的文章。这里的代码片段: -我如何从DotNetOpenID AX属性提取数据?
var fetch = openid.Response.GetExtension<FetchResponse>();
if (fetch != null)
{
IList<string> emailAddresses = fetch.GetAttribute
(WellKnownAttributes.Contact.Email).Values;
IList<string> fullNames = fetch.GetAttribute
(WellKnownAttributes.Name.FullName).Values;
string email = emailAddresses.Count > 0 ? emailAddresses[0] : null;
string fullName = fullNames.Count > 0 ? fullNames[0] : null;
}
当我尝试做以下...
fetch.GetAttribute(...)
我得到一个编译错误。基本上,这不存在。是唯一的(阅读:正确)的方式来做到这一点如下...
fetch.Attribue[WellKnownAttributes.Contact.Email].Values
欢呼:)
你知道,看到“正确”的代码是多么繁琐以获取一个单一的AX值促使我添加一个辅助方法到FetchResponse类。它将在v3.2中。 http://dotnetopenauth.net:8000/ticket/67 – 2009-05-21 03:40:10