I grabbed an example somewhere that lists the AD users in a console app. I converted it to an asp.net app and want to list the users on the page.... same exact code to retrieve the user list, and I get a count of 0 after I try a FindAll(). In the console app
I get a count of almost 1000. What gives? Is there a setting or premissions issue I should be aware of when using the aspnet user to execute this?
the ASPNET user won't have permission to list user accounts. you could change the context ASP.NET runs under in machine.config , but take care with that - there are many cases where this might be a bad idea. alternatively, force a login with IIS and ASP.NET
should run in the context of the user account supplied. j
RTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadable
It is easier to use the .Username and .Password properties for the DirectoryEntry. This will allow your code access to the Directory without having to switch process contexts.
thanks! I figured it was permissions based since I can get results from a console and windows app, but not an asp.net app. dunnry, I assume you mean a username and password on the direcotryentry? I tried that and am getting a logon failure (bad username or
password). I'm using my user/pass to test it - which I imagine should work, but isn't. I'll talk to my IT guy and get the proper credentials to use. If that doesn't work, what else might be the problem? Bad LDAP domain name?
I do mean DirectoryEntry.User and .Password. If it works in console, then likely this is only the permission issue. Specify the username in "DOMAIN\username" format. It should work fine if you can run from console with same credentials. Also, if you have been
testing this awhile, sometimes you accidentally lockout your account (bad password attempts) which will give you same error. Can you share your code here and I can take a look if it is something else?
Are you using the GetDirectoryEntry() method from the SearchResult anywhere in your code? If so, this would also be your problem. Nevermind... was typing this before seeing your last reply.
daver
Participant
873 Points
178 Posts
Not getting any results?
Aug 20, 2003 10:41 PM|LINK
Atrax
All-Star
18705 Points
3733 Posts
Re: Not getting any results?
Aug 21, 2003 06:14 AM|LINK
Jason Brown - MVP, IIS
dunnry
Star
9098 Points
1806 Posts
Re: Not getting any results?
Aug 21, 2003 02:18 PM|LINK
Weblog
The Book
LDAP Programming Help
daver
Participant
873 Points
178 Posts
Re: Not getting any results?
Aug 21, 2003 03:46 PM|LINK
dunnry
Star
9098 Points
1806 Posts
Re: Not getting any results?
Aug 21, 2003 05:48 PM|LINK
Weblog
The Book
LDAP Programming Help
daver
Participant
873 Points
178 Posts
Re: Not getting any results?
Aug 21, 2003 05:50 PM|LINK
dunnry
Star
9098 Points
1806 Posts
Re: Not getting any results?
Aug 21, 2003 05:51 PM|LINK
Weblog
The Book
LDAP Programming Help