I’m writing code to connect to my Active Directory server using LDAP. I can connect using
LDAP://celtestdomdc1.celtestdom.local
but I can’t connect using
LDAP://celtestdomdc1.celtestdom.local/CN=Users;DC=celtestdom
Am I using the wrong syntax or something?
Your LDAP string is wrong – use:
or even this (server-less binding – goes to the default DC)
First, the parts need to be separated by comma (
,) not semicolon – and second, you need to use theDC=....for all DNS-parts of your domain.<shameless plug>Also you might want to look at my ADSI browser called Beavertail which is written in C# and 100% free and open-source. It will show you what your domain tree looks like and what the valid LDAP paths are.
</shameless plug>