LDAP C#.NET问题 [英] LDAP C#.NET question

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

问题描述

我正在使用C#.NET连接到LDAP服务器上的电子邮件目录,目的是搜索/检索和添加电子邮件联系人.我正在使用freeldap.org,我相信它不是活动目录服务器.我试图弄清楚如何使用C#代码连接到LDAP服务器.我在网上找到了一些有关如何使用LDAP的示例,但似乎没有一个适用于我的设置. freeldap提供以下信息以访问其系统:

LDAP服务器ds1.us.freeldap.org
搜索库uid = 用户名,ou = People,o = entic.net
端口636(通过SSL加密)
绑定DN * uid = 用户名,ou = People,o = entic.net

因此到目前为止,我已经尝试过以下操作

DirectoryEntry.Path ="ldaps://ds1.us.freeldap.org:636/"和"ldaps://ds1.us.freeldap.org:636/ou = People,o = entic.net"只是"ds1.us.freeldap.org:636" ...还尝试了端口389,以防它通过TLS
DirectoryEntry.Username = myUsername 连接,并尝试了 Bind DN
DirectoryEntry.AuthenticationType = AuthenticationTypes .安全链路层; (不确定TLS是否存在一个).
DirectoryEntry.Password = myPassword

最后,我尝试使用以下方法获得结果:

SearchResultCollection res = DirectorySearcher.FindAll();

无论我得到什么,都是以下错误:{未知错误(0x80005000)"}.我只搜索有关Active Directory实现的内容.

我正在使用VS2008,并且该项目使用.NET 2.0

任何想法如何使用绑定DN和SSL来实现LDAP

谢谢!

I'm using C#.NET to connect to an email directory on an LDAP server for the purposes of searching/retrieving and adding email contacts.  I'm using freeldap.org which i believe is NOT an active directory server.  I'm trying to figure out how to use C# code to connect to the LDAP server.  I've found several examples on the web as to how to use LDAP, but none seem to work for my setup.  freeldap gives the following information to access their system:

LDAP Server      ds1.us.freeldap.org
Search base     uid=username , ou=People, o=entic.net
Port     636 (encrypted over SSL)
Bind DN*     uid=username , ou=People, o=entic.net

So far i've tried the following

DirectoryEntry.Path = "ldaps://ds1.us.freeldap.org:636/" and "ldaps://ds1.us.freeldap.org:636/ou=People, o=entic.net" and just "ds1.us.freeldap.org:636" ... also tried port 389 in case it connects over TLS
DirectoryEntry.Username = myUsername and tried the Bind DN
DirectoryEntry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer; (not sure if there is one for TLS)
DirectoryEntry.Password = myPassword

Finally i attempt to get results with:

SearchResultCollection res = DirectorySearcher.FindAll();

No matter what all i get is the follow error: {"Unknown error (0x80005000)"}.  I search only reveals stuff on Active Directory implementations..

I'm using VS2008 and this project uses .NET 2.0

Any idea how to implement LDAP with bind DN and SSL?

thanks!

推荐答案

您好,

我建议您在
http://forums.asp.net/93.aspx .这就是ASP.NET论坛中的Active Directory论坛队列.

最好的问候,
哈里

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

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