Hi,
Please show the code where you create your DirectorySearcher.
Looks like your web server can't find the domain controller of the domain
you specify
for the entry that you use to create your searcher with.
regards
Emil Kvarnhammar
> Hi,
>
[quoted text clipped - 6 lines]
> The specified domain either does not exist or could not be contacted
> Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information
about the error and where it originated in the code.
> Exception Details: System.Runtime.InteropServices.COMException: The specified domain either does not exist or could not be contacted
>
[quoted text clipped - 28 lines]
>
> mario
Mario - 28 Jul 2004 10:15 GMT
Hi,
thanx for your help
------------------------------------------------------------------
Dim entry As New DirectoryServices.DirectoryEntry("LDAP://ou=myusers,dc=nts,dc=at")
Dim mySearcher As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
mySearcher.Filter = "(ObjectClass=user)"
For Each result In mySearcher.FindAll()
DropDown.Items.Add(result.GetDirectoryEntry().Path)
Next
--------------------------------------------------------------
this code works fine in a windows application
> Hi,
>
[quoted text clipped - 62 lines]
> >
> > mario
postbryan - 28 Dec 2005 17:43 GMT
I have the same problem.
It is to do with Security in login credentials via IIS, which is not a
problem with Windows apps, as they use Windows Authentication.
I discovered this link to possible solutions:
http://support.microsoft.com/default.aspx?scid=kb;en-us;329986
postbryan - 28 Dec 2005 23:07 GMT
I finally got this to work in asp.net.
There are actually 2 ways to do it.
The first method is the simplest, using the full path to the domain. This
method will not work if you try to point to a specific AD container, using
paths like CN=x, DC=y, Dc=z OU=a etc.
sADPath = "LDAP://sdp-dc3.sdptech.com"
sADUser = "adminguy"
sADPassword = "adminpwd"
oDirectoryEntry = New DirectoryEntry
oDirectoryEntry.Path = sADPath
oDirectoryEntry.Password = sADPassword
oDirectoryEntry.Username = sADUser
oDirectoryEntry.AuthenticationType = AuthenticationTypes.Secure
so, how do you get to a specific container to query it?
You need to use the DirectorySearcher object and filter - I wont go into that
here, there are many examples of using the DirectorySearcher on the web
Anyway, you filter it such as:
(&(objectClass=user) (objectCategory=Person) (!(telephoneNumber=*)))
OK, the second method is a bit tricker, but allows you to use container
pointers in the LDAP declaration.
Dim oDirectoryEntry As DirectoryEntry
Dim sADPath As String
sADPath = "LDAP://DC=sdptech,DC=com,CN=Users"
oDirectoryEntry = New DirectoryEntry
oDirectoryEntry.Path = sADPath
if you try running this, you get errors. You need to set up IIS and also the
web config file as follows:
In IIS, navigate to the Virtual directory for the web application
In the console, select the aspx page that runs the code that accesses the
Active Directory.
Click "Properties" from popup menu, then select the "File Security" tab.
Click the "Edit" button to display the "Authentication Methods" form.
Ensure that "Integrated Windows Authentication" is checked.
Ensure that "Anonymous User" is checked.
All other options should be unchecked.
In the "Anonymous User" section:
select a DOMAIN user name (such as domain administrator) and user password
ensure that "Allow IIS to control password" is unchecked.
Finally, in your application web config file, ensure you have the following
entry:
<authentication mode="Windows" />
<identity impersonate="true" />