473,513 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

active directory search doesn't work

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.
Nov 16 '05 #1
3 3701
The webservice is probably running under the local IUSR_ or IWAM_ accounts
on the webserver, and that account does not have access to query the
directory.

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

"Ivan G." <iv************@hotmail.com> wrote in message
news:u6**************@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.

Nov 16 '05 #2
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." <iv************@hotmail.com> wrote in message
AB> news:u6**************@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.
Nov 16 '05 #3
Personally I use the .config file to store an encrypted version of the
username and password to use.

I you could get the webservice to run under a different useraccount (web
application pool in Win2003 server.) You may then be able to specify a
domain account for this apppool, and then that account would be used when
talking to the DC.

Another (but not recommended way) would be to open for anonymous access to
AD.
Arild

"Ivan G." <iv************@hotmail.com> wrote in message
news:ez**************@tk2msftngp13.phx.gbl...
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." <iv************@hotmail.com> wrote in message
AB> news:u6**************@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.

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5511
by: Victor Lokhmatov | last post by:
Hello Everyone, My company has asked me to put a company directory on our intranet site and I'm trying to use php to extract the users from our active directory server. I've got everything...
1
3928
by: Toufani | last post by:
Hi everybody, I want to retrieve information about objects in active directory windows 2000 and their properties. I got some codes that don't work absolutely. for example I can't retrieve users...
0
1828
by: Kenneth Keeley | last post by:
Hi, I have been working on a Login page that uses ADSI to authenicate the users. I had this all working on my test system and on a second system connected to the live domain. Now it will only work...
1
3878
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry =...
10
4033
by: Hriday | last post by:
Hi there, Please help me..It is urgent This is Hriday, working on windows authentication with Active Directory... My requirment is when a user sends a request to my web Applicatoin I want to...
2
5948
by: Jim in Arizona | last post by:
My goal, somehow, is to populate a dropdownlist with all the user names in active directory. I don't even know where to begin, really. I added a reference to System.DirectoryServices so I could...
18
23755
by: Arthur | last post by:
Hi All, I would like to get the name of the user given their networkID, is this something Active Directory would be useful for?(For intranet users) If so, can you please point me to some sample...
6
9900
by: jarice1978 | last post by:
Hello, I have been scanning the internet for a few days now. That is not working. So now it is time to post! I have read a few other posts on here about authentication but they do not match...
3
3002
by: =?Utf-8?B?YXppZWdsZXI=?= | last post by:
Hello, everybody. I'd like to do this: For a big program (a web service) I need information about the usergroups an active-directory-user is member of. To be more precise, I need to know if a...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7545
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7111
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5095
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.