Tech Support > Operating Systems > Windows 2003 > Active Dir: Works in WinForm app, not in WebForm
Active Dir: Works in WinForm app, not in WebForm
Posted by Chad on December 8th, 2003


I am trying to use Active Directory to look up the user's telephone given
his name.
The following code fragment works in a Windows desktop (win32) app but not
in a WebForm web application. I am getting the following error:

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

The WebApp is using NT Authentication. Here's some info security that I
displayed from the Web App:

Authenticated True
User Name NA\dokmanc
Type NTLM


Thinking that it may be a security privledges error, I temporarily added the
user ASPNet to the adminastrators group. Same error resulted.

Here's the code snippet:

Dim rootds As New DirectoryEntry("LDAP://rootDSE")
Dim strPath As String
Dim strDomain As String


Dim rootds As New DirectoryEntry("LDAP://rootDSE", "NA\DOKMANC", "MyPwd",
AuthenticationTypes.Secure)


'Dies on next line with error: The specified domain either does not exist or
could not be contacted
===================

strDomain = rootds.Properties("DefaultNamingContext").Item(0). ToString 'get
the name of the domain



Any help would be VERY much appreciated as I have spent a week already
trying to figure this damn thing out.



Similar Posts