473,624 Members | 2,253 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

DirectorySearch er searcher = new DirectorySearch er(entry,
"(|(objectclass =person)(object class=user))");

SearchResultCol lection result = searcher.FindAl l();

foreach(SearchR esult 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 3706
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******** ******@TK2MSFTN GP12.phx.gbl...
Hi.

I'm trying to search active directory for users like this:

DirectoryEntry entry = new DirectoryEntry( ); //use default domain

DirectorySearch er searcher = new DirectorySearch er(entry,
"(|(objectclass =person)(object class=user))");

SearchResultCol lection result = searcher.FindAl l();

foreach(SearchR esult 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******** ******@TK2MSFTN GP12.phx.gbl...
??>> Hi.
??>>
??>> I'm trying to search active directory for users like this:
??>>
??>> DirectoryEntry entry = new DirectoryEntry( ); //use default domain
??>>
??>> DirectorySearch er searcher = new DirectorySearch er(entry,
??>> "(|(objectclass =person)(object class=user))");
??>>
??>> SearchResultCol lection result = searcher.FindAl l();
??>>
??>> foreach(SearchR esult 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******** ******@tk2msftn gp13.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******** ******@TK2MSFTN GP12.phx.gbl...
??>> Hi.
??>>
??>> I'm trying to search active directory for users like this:
??>>
??>> DirectoryEntry entry = new DirectoryEntry( ); //use default domain
??>>
??>> DirectorySearch er searcher = new DirectorySearch er(entry,
??>> "(|(objectclass =person)(object class=user))");
??>>
??>> SearchResultCol lection result = searcher.FindAl l();
??>>
??>> foreach(SearchR esult 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
5519
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 working, however, when the list of users is shown in the output, it seems to display the users in the order their accounts were created, with Administrator obviously being first. What do you think would be the best way to get the list to be sorted by...
1
3938
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 list and group list separatedly.there is my code that downloaded from the internet : public class LdapAuthentication { private string _path;
0
1839
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 on my test system which is a win2K Server running as a domain controller and web server. The second system is a win2K workstation connected to the live win2K domain controller, This computer was able to run the code in the past and now all I keep...
1
3890
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 = New DirectoryEntry("LDAP://domain") Dim mySearcher As New DirectorySearcher(enTry) Dim resEnt As SearchResult mySearcher.Filter = ("(objectClass=*)") mySearcher.SearchScope = SearchScope.Subtree
10
4046
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 Pop up windows Authentication box so that user will give his userId, Password & domain name for authenticaion. After that I want to take these three info of user and make a search in Active Directory.
2
5959
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 use the System.DirectoryServices.ActiveDirectory namespace. I don't even know if this is the right way to go as I can't seem to find anything in that namespace that would help me query active directory for names. I can't use an LDAP query...
18
23778
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 code/examples? Thanks in advance, Arthur
6
9921
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 exactly. We currently have an intranet app built in a mixture of asp and asp.net 1.1 and 2.0 written in VB .Net. We have a form where the user logs in and it authenticates against active directory successully in 2 ways: 1. The admin resets the...
3
3009
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 particular user is in a particular group or not. This is my first Active-Directory-query in a C#-program, so it might look crude or primitive...well, it doesn't work anyway... The interesting part of the code is this:
0
8680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8336
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8478
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2607
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 we have to send another system
1
1786
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1485
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.