Paged LDap search fails with quot;The requested attribute does not existsquot;(分页 LDap 搜索失败并显示“请求的属性不存在;)
问题描述
我需要使用使用 .NET/C# 实现的 Ldap 搜索来获取epersonstatus=REMOVE"的所有员工的员工编号",例如:
I need to get the 'employeenumber' of all the employees whose 'epersonstatus=REMOVE' using an Ldap search implemented using .NET/C# like:
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
Since there are thousands of entries I am using paged requests as proposed here: http://dunnry.com/blog/PagingInSystemDirectoryServicesProtocols.aspx
我还检查了服务器是否支持此处建议的分页请求:iPlanet LDAP 和 C# PageResultRequestControl
I have also checked that the server supports paged requests as proposed here: iPlanet LDAP and C# PageResultRequestControl
一旦流量到达:
SearchResponse response = connection.SendRequest(request) as SearchResponse;
我收到一个带有消息请求的属性不存在"的 DirectoryOperationException.
I get a DirectoryOperationException with message "The requested attribute does not exist".
通过在像 softerra 这样的 LDap 客户端上运行相同的查询,我得到了条目(一千个)和错误.
By running the same query on a LDap client like softerra I get the entries (a thousand) and the error.
我们将不胜感激.
推荐答案
我遇到了类似的问题.
当使用分页搜索时,我得到了异常服务器不支持该控件.该控件很关键.",当使用非分页搜索时,我收到了结果(至少只要过滤器限制了最大数量).
When using paged search, I got the exception "The server does not support the control. The control is critical.", when using non-paged search I received results (at least as long as the filter restricted the maximum number).
但我发现,错误消息具有误导性 - 问题隐藏在身份验证中.
However I found out, that the error message is misleading - The problem was buried in the authentication.
使用 AuthType.Basic(或 AuthType.Anonymous)我收到了错误.我切换到 AuthType.Ntlm 后,它就开始工作了.
Using AuthType.Basic (or AuthType.Anonymous) I received the error. Bus as soon as I switched to AuthType.Ntlm it worked.
希望这会有所帮助...
Hope this helps...
这篇关于分页 LDap 搜索失败并显示“请求的属性不存在";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:分页 LDap 搜索失败并显示“请求的属性不存在";
基础教程推荐
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 将数据集转换为列表 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 如果条件可以为空 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
