dflynn21
asked on
Authenication Code
I’m trying to add some AD authentication code to my application and am getting some errors such as:
Error 1 Type 'System.DirectoryServices. DirectoryE ntry' is not defined.
Error 2 Type 'System.DirectoryServices. DirectoryS earcher' is not defined.
Error 3 Name 'DirectoryServices' is not declared.
Error 4 Type 'System.DirectoryServices. SearchResu lt' is not defined.
Did they change this in VS2005?
Code found on the Net:
Private Function ValidateActiveDirectoryLog in(ByVal Domain As String, ByVal Username As String, ByVal Password As String) As Boolean
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.D irectoryEn try("LDAP: //" & Domain, Username, Password)
Dim Searcher As New System.DirectoryServices.D irectorySe archer(Ent ry)
Searcher.SearchScope = DirectoryServices.SearchSc ope.OneLev el
Try
Dim Results As System.DirectoryServices.S earchResul t = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch
Success = False
End Try
Return Success
End Function
Error 1 Type 'System.DirectoryServices.
Error 2 Type 'System.DirectoryServices.
Error 3 Name 'DirectoryServices' is not declared.
Error 4 Type 'System.DirectoryServices.
Did they change this in VS2005?
Code found on the Net:
Private Function ValidateActiveDirectoryLog
Dim Success As Boolean = False
Dim Entry As New System.DirectoryServices.D
Dim Searcher As New System.DirectoryServices.D
Searcher.SearchScope = DirectoryServices.SearchSc
Try
Dim Results As System.DirectoryServices.S
Success = Not (Results Is Nothing)
Catch
Success = False
End Try
Return Success
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER