Re: active directory search doesn't work

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ivan G. (ivan_gavrilyuk_at_hotmail.com)
Date: 08/19/04


Date: Thu, 19 Aug 2004 13:50:56 +0300

Hi, Arild!
You wrote on Thu, 19 Aug 2004 12:37:23 +0200:

Thanks after i specify domain username and password it works fine. But what
can I do to query directory without specifying any password (easy deployment
needed).

 AB> Specify a username and password to use in the search by specifying that
 AB> for the searchroot DirectoryEntry (entry object in your sample).

 AB> Arild

 AB> "Ivan G." <ivan_gavrilyuk@hotmail.com> wrote in message
 AB> news:u6zrbbdhEHA.3664@TK2MSFTNGP12.phx.gbl...
 ??>> Hi.
 ??>>
 ??>> I'm trying to search active directory for users like this:
 ??>>
 ??>> DirectoryEntry entry = new DirectoryEntry(); //use default domain
 ??>>
 ??>> DirectorySearcher searcher = new DirectorySearcher(entry,
 ??>> "(|(objectclass=person)(objectclass=user))");
 ??>>
 ??>> SearchResultCollection result = searcher.FindAll();
 ??>>
 ??>> foreach(SearchResult r in result)
 ??>>
 ??>> {
 ??>>
 ??>> ...
 ??>>
 ??>> But it finds nothing when calling from web service. When doing the
 ??>> same from normail application result are what expected. Why?
 ??>>
 ??>> Thanx.
 ??>>

Me.