S
Support
If you call DirectoryEntry with hardcoded password ("in this case
"password")- this will work but if you pass mypassword instead it will fail
...
Dim theusername as string ="someting", thepassword as string="somethingelse"
Response.Write(DoYouExist(theusername,thepassword).ToString())
This is strange behavior ....
Imports System.DirectoryServices
Private Function DoYouExist(ByVal myusername As String, ByVal mypassword As
String) As Boolean
Dim entry As New DirectoryEntry(LDAP://whatever, myusername ,"password")
Dim mySearcher = New DirectorySearcher(entry)
Dim results As SearchResultCollection
Dim MySearchAccount As String = "SAMAccountName=ArchieBald"
mySearcher.Filter = (MySearchAccount)
results = mySearcher.FindAll()
Dim result As SearchResult
Try
results = mySearcher.FindAll()
Catch ex As Exception
DoYouExist = False
Exit Function
End Try
If results.Count > 0 Then DoYouExist = True Else DoYouExist = False
End Function
"password")- this will work but if you pass mypassword instead it will fail
...
Dim theusername as string ="someting", thepassword as string="somethingelse"
Response.Write(DoYouExist(theusername,thepassword).ToString())
This is strange behavior ....
Imports System.DirectoryServices
Private Function DoYouExist(ByVal myusername As String, ByVal mypassword As
String) As Boolean
Dim entry As New DirectoryEntry(LDAP://whatever, myusername ,"password")
Dim mySearcher = New DirectorySearcher(entry)
Dim results As SearchResultCollection
Dim MySearchAccount As String = "SAMAccountName=ArchieBald"
mySearcher.Filter = (MySearchAccount)
results = mySearcher.FindAll()
Dim result As SearchResult
Try
results = mySearcher.FindAll()
Catch ex As Exception
DoYouExist = False
Exit Function
End Try
If results.Count > 0 Then DoYouExist = True Else DoYouExist = False
End Function