This project is read-only.

How to test LDAP connection?

Mar 28, 2012 at 8:04 AM

hi, I want to konw when i configure the LDAP hostname and port, how to test whether it is correct? thanks

Mar 29, 2012 at 8:06 PM

If you enumerate the DirectoryContext ListServerAttributes method results that should serve as a test of the connection.  The values there are the same that you see when you make a connection with the server using LDP.EXE.

Mar 30, 2012 at 1:17 AM

thanks,but I want to use linq to ldap to write a small program that allows users to change the connection setting such as host parameter,Credentials. how can I know the user's settings are correct.


Mar 30, 2012 at 4:19 AM
Edited Mar 30, 2012 at 4:52 AM

If you issue a Bind request on the LdapConneciton it will tell you if the connection information is valid.  You can find more about it here.


//Using LdapConnection directly
LdapDirectoryIdentifier identifier = new LdapDirectoryIdentifier("server", 389);
LdapConnection connection = new LdapConnection(identifier);

//Using LdapConnectionFactory
var factory = new LdapConnectionFactory("server")

//Using via LdapConfiguration
var configuration = new LdapConfiguration();
Mar 31, 2012 at 1:31 AM