2012-08-07 48 views
1

我需要得到其“epersonstatus =删除”使用LDAP搜索使用实现了所有员工的“employeenumber” .NET/C#这样的:分页LDAP搜索失败“的请求的属性不存在”

var connection = new LdapConnection("foo.bar.com:389"); 

connection.AuthType = AuthType.Anonymous; 
connection.SessionOptions.ProtocolVersion = 3; 
connection.Bind(); 

var request = new SearchRequest(
       "dc=root,dc=com", 
       "(epersonstatus=REMOVE)", 
       SearchScope.Subtree, 
       new string[] { "employeenumber" }); 

由于拟议这里有成千上万我使用分页请求的条目: http://dunnry.com/blog/PagingInSystemDirectoryServicesProtocols.aspx

我还检查了为这里提出的服务器支持分页请求: iPlanet LDAP and C# PageResultRequestControl

一旦流量达到:

SearchResponse response = connection.SendRequest(request) as SearchResponse; 

我得到消息DirectoryOperationException“的请求的属性不存在”。

通过在像softerra这样的LDap客户端上运行相同的查询,我得到了条目(一千)和 的错误。

一些帮助将不胜感激。

回答

2

我有类似的问题。

当使用分页搜索时,我得到了例外"The server does not support the control. The control is critical.",当使用非分页搜索时,我收到了结果(至少只要过滤器限制了最大数量)。

但是我发现,错误信息是误导 - 问题被埋在了身份验证中。

使用AuthType.Basic(或AuthType.Anonymous)我收到错误。公共汽车,只要我切换到AuthType.Ntlm它的工作。

希望这有助于...

+0

这有帮助,谢谢。我遇到了类似的问题,在加入服务器的域中,Basic运行正常,但一旦发布到非域加入服务器,它在同一时刻失败。确保我使用AuthType.Ntlm允许请求成功。 – Willisterman 2015-07-23 09:42:34

+0

感谢@Marc,这也帮助了我。我在这里发布了一个问题[如何解决]“服务器不支持该控件。该控件是关键。“Active Directory错误](http://stackoverflow.com/questions/33634669/how-to-resolve-the-server-does-not-support-the-control-the-control-is-critical ),然后发现这一点。 – Justin 2015-11-10 17:12:40