简体   繁体   中英

How to connect to ldap data source other than Active Directory from c# code?

I am looking to connect and retrieve data from ldap data source other than Active Directory. I tried using DirectoryEntry but its meant for Active Directory objects and so doesn't seem to work with others. Are there any other options in c# to connect and fetch data from ldap sources?

    DirectoryEntry de = new DirectoryEntry(LDAP://127.0.0.1/CN=Users,dc=test,dc=com", UserName, Password, AuthenticationTypes.Secure);
        DirectorySearcher ds = new DirectorySearcher(de);
         ds.FindOne();

1. Replace "127.0.0.1" by your IP. 2. UserName= LDAP User Name 3. Passwoed =LDAP User Password. 4. DC(Domain Component)= your domain component 5. CN (Common Name) = your Common Name This code works for me to connect LDAP server.

more What are CN, OU, DC in an LDAP search?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM