使用的DirectoryServices C#连接到LDAP [英] Connecting to LDAP from C# using DirectoryServices

查看:180
本文介绍了使用的DirectoryServices C#连接到LDAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到的eDirectory 8.8服务器上运行LDAP。我怎么会去这样做在.net中?我仍然可以使用在System.DirectoryService类等的DirectoryEntry和DirectorySearcher从或者他们AD具体点吗?我需要指定连接字符串有什么不同?

I am trying to connect to an edirectory 8.8 server running LDAP. How would I go about doing that in .Net? Can I still use the classes in System.DirectoryService such as DirectoryEntry and DirectorySearcher or are they AD specific? Do I need to specify the "Connection String" any differently?

我想类似下面的code,但它似乎没有工作...

I am trying something like the code below but it doesn't seem to work...

DirectoryEntry de = new DirectoryEntry ("LDAP://novellBox.sample.com","admin","password",AuthenticationTypes.None);
DirectorySearcher ds = new DirectorySearcher(de);
var test = ds.FindAll();

任何想法?

推荐答案

好吧,我想你的连接字符串缺少位 - 仅指定的服务器名称是不够的 - 你还需要指定一个起点为您的搜索。

Well, I think your connection string is missing a bit - specifying just the server name isn't good enough - you also need to specify a "starting point" for your search.

在AD,这通常是像在您的域名,在用户容器,你会指定这样的LDAP说法:

In AD, this would typically be something like the "Users" container in your domain, which you'd specify like this in LDAP parlance:

LDAP://novellBox.sample.com/cn=Users,dc=YourCompany,dc=com

不知道怎么LDAP兼容的eDirectory的较新版本 - 但因为在理论上,应该工作,它是标准的LDAP无论执行情况: - )

Not sure how LDAP compliant the newer versions of eDirectory are - but that should work since in theory, it's standard LDAP regardless of the implementation :-)

不过话又说回来:仅在理论上存在的理论与实践之间没有什么区别......

But then again: only in theory, there's no difference between theory and practice.....

还有一个 System.DirectoryServices.Protocols 命名它提供低级别的LDAP直接调用 - 这绝对不是绑的广告,但它确实相当低水平.....

There's also a System.DirectoryServices.Protocols namespace which offers low-level LDAP calls directly - and that's definitely not tied to AD at all, but it's really quite low-level.....

还有一个 Novell的C#LDAP库的,但我从来没有尝试过不能说这是多么完整的或能。它可能给你一些线索,但!

There's also a Novell C# LDAP library but I've never tried it and can't say how complete or capable it is. It might give you some clues, though!

另请参阅该其他<一个href=\"http://stackoverflow.com/questions/386982/novell-ldap-c-novell-directory-ldap-has-anybody-made-it-work\">Stackoverflow 有关Novell,LDAP和C#的问题 - 它可能给你更多的信息

Also see this other Stackoverflow question about Novell, LDAP and C# - it might give you additional info.

这篇关于使用的DirectoryServices C#连接到LDAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆