【问题标题】:Connect to an LDAP database from C# and return an array从 C# 连接到 LDAP 数据库并返回一个数组
【发布时间】:2012-05-19 13:05:52
【问题描述】:

基本上我想从 C# .Net 连接到一个 LDAP 数据库并返回一个对象数组。

我们有一个第三方软件可以在 PHP 中成功地做到这一点,PHP 代码如下:

$ds = @ldap_connect("127.0.0.1",4000)
@ldap_bind($ds,"XXXXX","88888")
$sr=@ldap_list($ds,"cn=Registrations","objectclass=RegistrationRecord",$att);
$info=@ldap_get_entries($ds,$sr);

我该从哪里开始在 C# 中重复这个?我什至不是在寻找一个完整的解决方案,只要有人朝正确的方向轻推就会在我迷路时大有帮助!

谢谢

约翰

【问题讨论】:

    标签: c# php .net ldap


    【解决方案1】:

    您可以使用Directory EntryLdapConnection Class

    DirectoryEntry de = new DirectoryEntry("LDAP://127.0.0.1","admin","password",AuthenticationTypes.None);
    DirectorySearcher ds = new DirectorySearcher(de);
    var findAll = ds.FindAll();
    

    来源:

    Connecting to LDAP from C# using DirectoryServices

    LDAP Connection

    Connecting to an LDAP Connection

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-18
      • 1970-01-01
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多