DirectoryEntry Help

From: Faraz Khan (faraz.khan@ezdoc.net)
Date: 04/03/03


From: faraz.khan@ezdoc.net (Faraz Khan)
Date: 2 Apr 2003 19:30:10 -0800


Please help. I am trying to run the following code in a ASP.NET page.

Line 1: Dim DS As New
System.DirectoryServices.DirectoryEntry("LDAP://RootDSE", "fkhan",
"mypassword", DirectoryServices.AuthenticationTypes.Secure)
Line 2: Dim DNC As String = DS.Invoke("Get", "DefaultNamingContext")

Generates this error at Line 2:
System.Runtime.InteropServices.COMException (0x8007054B): The
specified domain either does not exist or could not be contacted.

Now. I understand that this code will run under the security context
of ASPNET account, which does not have access to the Active Directory.
 But why does it not work when i am specifaclly providing my own login
and password to the DirectoryEntry constructor? I keep getting the
above error. I have tried other forms of my username (e.g.
"domain\fkhan" or "cn=fkhan") to no avail. The user name or password
is correct becasue I have used it as a test elsewhere to Impersonate
my account, which then makes the above code work, after giving
SeTcbPrivilege to the ASPNET account.

This code must run on a public webserver so there is no option for
Integrated or Basic authentication. I can make it work by using
impersonation, but i dont want to alter ASPNET's previleges or IIS
settings (e.g. running the code under a domain account instead of
ASPNET).



Relevant Pages

  • Re: ASPNET account for windows 2000 server
    ... The ASPNET account is added to the local user database, not Active Directory. ... (SQL Server 2000) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Where does ASPNET come from?
    ... and it had .Net 2.0 framework but there was no ASPNET account in Active Directory like there is in ours. ... Mark Rae ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: C#.NET reading remote host directory contents
    ... rights to access the folder. ... By defaul web application runs under ASPNET account. ... Impersonate your web application with valid NT credentials in the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: ASPNET permissions
    ... I dont want the aspnet account to be able to run as admin. ... > the best thing to do would be to impersonate to the admin account. ...
    (microsoft.public.dotnet.framework.aspnet)
  • cmd.exe should run in impersonate account.
    ... ProcessStartInfo oProcessStartInfo = new ProcessStartInfo; ... it is running in the aspnet account and not ... How will I run in the impersonate ... to launching user concept to dcomcnfg.exe). ...
    (microsoft.public.dotnet.framework.aspnet.security)