【发布时间】:2014-02-27 13:52:26
【问题描述】:
我想使用 Windows 身份验证并获取用户信息,例如 Givenname、Surname 等。
我在 IIS 中使用了UserPrincipal.Current,但遇到了异常,但 IIS express 看起来不错。
【问题讨论】:
标签: asp.net windows-authentication userprincipal groupprincipal
我想使用 Windows 身份验证并获取用户信息,例如 Givenname、Surname 等。
我在 IIS 中使用了UserPrincipal.Current,但遇到了异常,但 IIS express 看起来不错。
【问题讨论】:
标签: asp.net windows-authentication userprincipal groupprincipal
我使用查找方法解决了:
var domain = new PrincipalContext(ContextType.Domain);
var currentUser = UserPrincipal.FindByIdentity(domain, User.Identity.Name);
【讨论】: