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 搜索失败并显示“请求的属性不存在";


基础教程推荐
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01