【问题标题】:Paged LDap search fails with "The requested attribute does not exists"分页 LDap 搜索失败并显示“请求的属性不存在”
【发布时间】:2013-01-10 18:38:57
【问题描述】:

我需要使用使用 .NET/C# 实现的 Ldap 搜索来获取“epersonstatus=REMOVE”的所有员工的“员工编号”,例如:

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 客户端上运行相同的查询,我得到了条目(一千个)和 错误。

我们将不胜感激。

【问题讨论】:

    标签: c# ldap


    【解决方案1】:

    我也有类似的问题。

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

    但是我发现,错误消息具有误导性 - 问题隐藏在身份验证中。

    使用AuthType.Basic(或AuthType.Anonymous)我收到了错误。当我切换到AuthType.Ntlm 时,它工作了。

    希望这会有所帮助...

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-18
    • 2020-10-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多