DirectoryServices and ASP.Net

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
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...
 
Hi there

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