How can I get the distinguished name from Active Directory of the currently logged in user in C#?
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Generic Generics in Managed C++
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Why wouldn't you just use:
System.DirectoryServices.AccountManagement.UserPrincipal.Current.DistinguishedName
Check following snippet. You have pass to
Identity.Name
from IPrincipal. I assume that the user is already authenticated in Active Directory (ie. using standard IIS authorization methods).