2

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" }); 

Since there are thousands of entries I am using paged requests as proposed here: http://dunnry.com/blog/PagingInSystemDirectoryServicesProtocols.aspx

I have also checked that the server supports paged requests as proposed here: iPlanet LDAP and C# PageResultRequestControl

Once the flow reaches:

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

I get a DirectoryOperationException with message "The requested attribute does not exist".

By running the same query on a LDap client like softerra I get the entries (a thousand) and the error.

Some help would be greatly appreciated.

Community
  • 1
  • 1
Umberto Gotti
  • 43
  • 1
  • 5

1 Answers1

3

I had a similar issue.

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.

Using AuthType.Basic (or AuthType.Anonymous) I received the error. Bus as soon as I switched to AuthType.Ntlm it worked.

Hope this helps...

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Marc
  • 31
  • 2
  • This helped, thanks. I was having a similar issue, where on a domain joined server, Basic was working fine, but once released to a non domain joined server it was failing at the same point. Ensuring that I was using AuthType.Ntlm allowed the request to succeed. – Willisterman Jul 23 '15 at 09:42
  • Thanks @Marc, this helped me too. I had posted a question here [How to resolve β€œThe server does not support the control. The control is critical.” Active Directory error](http://stackoverflow.com/questions/33634669/how-to-resolve-the-server-does-not-support-the-control-the-control-is-critical) and then found this. – Justin Nov 10 '15 at 17:12