G
Guest
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
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