By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

AD problems... can't find domain???

P: n/a
HELP...

Can someone please tell me why I keep getting the following error! I am new
to AD is ASP.NET and would really appritiate any advice!

Thanks

...ERROR..
Exception Details: System.Runtime.InteropServices.COMException: The
specified domain either does not exist or could not be contacted

Source Error:
Line 50: ' Use the FindOne method to find the object, which in this
case, is the user
Line 51: ' indicated by User Name and assign it to a SearchResult.
Line 52: Dim ResEnt As SearchResult = mySearcher.FindOne()
Line 53: ' Assign a property name to propKey.
Line 54: Dim propKey As String

...CODE..
Sub SetupSession()
Dim strUserName As String
Dim strADPath As String

strUserName = "netadmin" 'HttpContext.Current.User.Identity.Name
strADPath = "cn=users,dc=server,dc=dk"

Dim Entry As DirectoryEntry = New DirectoryEntry("LDAP://" &
strADPath, "username", "password")
' Create a DirectorySearcher object.
Dim mySearcher As New DirectorySearcher(entry)
' Use the FindOne method to find the object, which in this case, is
the user
' indicated by User Name and assign it to a SearchResult.
Dim ResEnt As SearchResult = mySearcher.FindOne()
' Assign a property name to propKey.
Dim propKey As String
' Assign a property name to propKey.
For Each propKey In ResEnt.Properties.PropertyNames
' Assign the property value to prop.
Dim prop As [Object]
' Assign the property value to prop.
For Each prop In ResEnt.Properties(propKey)
' Handle results. Be aware that the following WriteLine
' only returns readable results for properties that are
strings.
Console.WriteLine("{0}:{1}", propKey, prop.ToString())
Next prop
Next propKey
' Add error handling.

End Sub
Nov 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.