DirectoryServices and ASP.Net

G

Guest

I wrote the following code in a ASP.Net page:

DirectoryEntry objDE;
string strPath="LDAP://DC=cna,DC=com";

// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);

foreach(DirectoryEntry objChildDE in objDE.Children)
Response.Write(objChildDE.Path);

When I try to run the code, I get the following error:
"The specified domain either does not exist or could not be contacted."

When I run the same code as a Console Application/WinForms, it works fine. I believe it is some permission issue but am not able to nail it. Can somebody please help me?
 
E

Egbert Nierop \(MVP for IIS\)

dopey said:
I wrote the following code in a ASP.Net page:

DirectoryEntry objDE;
string strPath="LDAP://DC=cna,DC=com";
// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);

foreach(DirectoryEntry objChildDE in objDE.Children)
Response.Write(objChildDE.Path);

When I try to run the code, I get the following error:
"The specified domain either does not exist or could not be contacted."
When I run the same code as a Console Application/WinForms, it works fine.
I believe it is some permission issue but am not able to nail it. Can
somebody please help me?

local server account IUSR_xx has no rights to query that path... the easiest
solution is to run in non-anonymous mode, or to change that account...
 
C

ckempste

Hi there

Did you a solution to this? we tried altering the run-as account for
the site to administrator and still no luck.
 

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,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top