ldap - DirectorySearcher works for mail, but not for cn C# -


i'm french please indulgent poor english :p

i have problem when want retrieve user cn against ldaps.

this code works fine when want retrieve users mail, not cn ... don't understand why. when run research ldp.exe, both good, same search string ! it's in c# doeasn't work, 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 don't understand ... result null when search cn, , ok when search mail ... ><

if error, great ^^

ok, found answer problem yesterday evening.

the problem bad authentication against directoryentry... because of this, directorysearcher searching in wrong way.

simple solution, fault. 1 entire day find 1 line.

thanks !


Comments