分页 LDap 搜索失败并显示“请求的属性不存在";

Paged LDap search fails with quot;The requested attribute does not existsquot;(分页 LDap 搜索失败并显示“请求的属性不存在;)
本文介绍了分页 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 搜索失败并显示“请求的属性不存在";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)