Can PrincipalContext be used to get Active Directory information if computer is not domained joined
I am using PrincipalContext. I am receiving "The LDAP server is unavailable." "Cannot be reached". I am developing from a machine that is not joined to the domain I want to query. Does开发者_如何学Go this matter? Do I need to pass admin creds to connect to AD, so I can query or search it?
My code resembles this: http://www.codeproject.com/KB/system/usingAccountManagement.aspx
It does matter. But you can get your site access by setting an <identity>
tag in web.config to a user with ldap reading privileges:
<system.web>
<identity userName="DOMAIN\ldapUser" password="ldapPW"/>
</system.web>
here's a msdn
精彩评论