简体   繁体   English

如何从c#代码连接到Active Directory以外的ldap数据源?

[英]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. 我期待从Active Directory以外的ldap数据源连接和检索数据。 I tried using DirectoryEntry but its meant for Active Directory objects and so doesn't seem to work with others. 我尝试使用DirectoryEntry,但它适用于Active Directory对象,因此似乎不能与其他人一起使用。 Are there any other options in c# to connect and fetch data from ldap sources? c#中还有其他选项来连接和从ldap源获取数据吗?

    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. 1.用您的IP替换“127.0.0.1”。 2. UserName= LDAP User Name 3. Passwoed =LDAP User Password. 2. UserName = LDAP用户名3. Passwoed = LDAP用户密码。 4. DC(Domain Component)= your domain component 5. CN (Common Name) = your Common Name This code works for me to connect LDAP server. 4. DC(域组件)=您的域组件5. CN(公用名)=您的公用名此代码可用于连接LDAP服务器。

more What are CN, OU, DC in an LDAP search? 更多LDAP搜索中的CN,OU,DC是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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