Access Active Directory from ASP.net 2.0 application

G

Guest

Hi all,

I need to access information from Active Directory from my ASP.net 2.0
application (vb.net). Therefore I made a DLL which retrieves the data from
Active Directory. This works fine, all tests successfull. But when I call
this DLL from my web application (currently installed on my local SQL Server)
I always get an error message:

"The specified domain either does not exist or could not be contacted."

I tested it with the same values in the DLL-Test and it works fine so it
seems to be a problem accessing the AD from IIS? The error is thrown in this
line:

"If Not (dirSearcher.FindOne() Is Nothing) Then"

Many thanks in advance!
Kai
 
M

Mark Rae

I need to access information from Active Directory from my ASP.net 2.0
application (vb.net). Therefore I made a DLL which retrieves the data from
Active Directory. This works fine, all tests successfull. But when I call
this DLL from my web application (currently installed on my local SQL
Server)
I always get an error message:

"The specified domain either does not exist or could not be contacted."

I tested it with the same values in the DLL-Test and it works fine so it
seems to be a problem accessing the AD from IIS? The error is thrown in
this
line:

"If Not (dirSearcher.FindOne() Is Nothing) Then"

Many thanks in advance!

The default account which ASP.NET uses does not have permission to query
ActiveDirectory - you will need to impersonate a "standard" Domain User
account for this:
http://www.codeproject.com/useritems/everythingInAD.asp
http://support.microsoft.com/kb/317012
http://www.15seconds.com/issue/020730.htm
http://support.microsoft.com/kb/326340
 
G

Guest

Hi Mark,
thanks for your reply. I just set impersonation to 'true' in web.config and
it's running fine now... I wonder why there is a impersonation class on
CodeProject.... It sounds so difficult but was really easy now. But I guess I
should read this one at weekend as there are some information about possible
security problems ...

http://msdn2.microsoft.com/en-us/library/ms998351.aspx
 
M

Mark Rae

thanks for your reply. I just set impersonation to 'true' in web.config
and
it's running fine now...
Hurrah!

I wonder why there is a impersonation class on CodeProject....

As an example of another way of doing things, I suppose - the .NET Framework
is so feature-rich that there is (almost) always more than one way of doing
anything...
It sounds so difficult but was really easy now. But I guess I
should read this one at weekend as there are some information about
possible
security problems ...

http://msdn2.microsoft.com/en-us/library/ms998351.aspx

Also, you might like to have a look in microsoft.public.adsi.general -
anything that Joe Kaplan says, you can take as gospel... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top