Question

I'm french so please be indulgent with my poor english :P

I have a problem when i want to retrieve a user by CN against LDAPS.

This code works fine when i want to retrieve users by mail, but not by cn ... Don't understand why. When i run my research with ldp.exe, both are good, with the same search string ! it's just in C# it doeasn't work, just with CN.

String strFilter = "(&(objectClass=person)(cn=user1))";
//String strFilter = "(&(objectClass=person)(mail=user1@sps.dev))";
objSearchADLDS = new DirectorySearcher(objADLDS);
objSearchADLDS.Filter = strFilter;
objSearchADLDS.SearchScope = SearchScope.Subtree;
SearchResult result = objSearchADLDS.FindOne();

I really don't understand ... result is null when i search by cn, and is OK when i search by mail ... ><

If someone could help with this error, it would be great ^^

Was it helpful?

Solution

Ok, i just found answer to this problem yesterday evening.

The problem was a bad authentication against DirectoryEntry... Because of this, DirectorySearcher was searching in wrong way.

Simple solution, my fault. One entire day to find one line.

Thanks to all !

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top