문제

I want to use Windows Authentication and get User info such as Givenname, Surname, etc. I used UserPrincipal.Current in IIS and I got an exception, but IIS express looks fine.

도움이 되었습니까?

해결책

I solved by using a Find Method:

var domain = new PrincipalContext(ContextType.Domain);
var currentUser = UserPrincipal.FindByIdentity(domain, User.Identity.Name);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top