I have installed an openldap for windows
server and I use LDAPAdmin
to connect to it by its default values :
Server=ldap://localhost:389
Base:dc=maxcrc,dc=com
UserName:cn=Manager,dc=maxcrc,dc=com
Password:secret
Now I want to use PrincipalContext
to add users to my ou=People
The problem is I can't even connect to the server using PrincipalContext. I have searched the Net and found a lot of answers on how to connect to a ldap server but none of them are working for me.I keep getting a NullReferenceException
or ServerNotFoundException
for different combination of provided parameters for PrincipalContext constructor.
I thought I could use PrincipalContext as one of the follows :
new PirncipalContext(ContextType.Domain,"maxcrc.com","dc=maxcrc,dc=com")
or
new PrincipalContext(ContextType.ApplicationDirectory,"localhost:389","dc=maxcrc,dc=com")
but none of them are working.Some say that I should provide username and password so I did that but I keep getting exception.
So please tell me how can I use PrincipalContext to connect to openldap ?
P.S. My computer is already joined to an Active Directory domain controller.