Hi,
code:
Try
'objDirEntry = New
DirectoryEntry("LDAP://ldap.myCompany.com:636/uid=" & uid &
",ou=People,o=hp.com", "uid=" & uid & ",ou=People,o=hp.com", passwd,
AuthenticationTypes.Secure)
objDirEntry = New
DirectoryEntry("LDAP://ldap.myCompany.com:636/uid=" & uid &
",ou=People,o=myCompany.com", uid, passwd, AuthenticationTypes.Secure)
Catch ex As System.Exception
ErrorLabel.Text = ex.Message
End Try
Dim errortext As String
' get the data from the form
Dim UName As String = username.Text
Dim UDomain As String = domain.Text
Dim UserLogin As String = UDomain & ":" & UName
Dim searcher As DirectorySearcher
' execute search
searcher = New DirectorySearcher(objDirEntry)
searcher.Filter = "(ntUserDomainId=" & UserLogin & ")"
ErrorLabel.Text = searcher.FindOne().Path // <-- this throws the
Exception
Try
Dim dirEntry As New DirectoryEntry(searcher.FindOne().Path,
objDirEntry.Username, objDirEntry.Password, objDirEntry.AuthenticationType)
ErrorLabel.Text =
objDirEntry.Exists(searcher.FindOne().Path).ToString
Catch ex As System.Runtime.InteropServices.COMException
ErrorLabel.Text = ex.Message
'End Try
Exception:
System.Runtime.InteropServices.COMException: The server is not operational
Stack Trace:
COMException (0x8007203a): The server is not operational]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObject() +10
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindOne() +31
I only get this Exception when I try to bind a user to the AD. There is no
exception if I read some data from the Directory (like username).
Thanks again
Nico