Emc2
JF-Expert Member
- Sep 26, 2011
- 16,808
- 16,953
''' <summary>
''' This is the friend class which used to manage daomain login.
''' </summary>
''' <remarks></remarks>
Friend Class LoginManager
Friend Shared Function Authentification(ByVal username As String, ByVal pwd As String) As Boolean
Dim entry As New DirectoryEntry("LDAP://" & Environment.UserDomainName, username, pwd)
Dim obj As Object
Try
obj = entry.NativeObject
Dim search As New DirectorySearcher(entry)
Dim result As SearchResult
search.Filter = "(SAMAccountName=" + username + ")"
search.PropertiesToLoad.Add("cn")
result = search.FindOne()
If result Is Nothing Then
Return False
End If
Catch ex As Exception
Return False
End Try
Return True
End Function
End Class
''' This is the friend class which used to manage daomain login.
''' </summary>
''' <remarks></remarks>
Friend Class LoginManager
Friend Shared Function Authentification(ByVal username As String, ByVal pwd As String) As Boolean
Dim entry As New DirectoryEntry("LDAP://" & Environment.UserDomainName, username, pwd)
Dim obj As Object
Try
obj = entry.NativeObject
Dim search As New DirectorySearcher(entry)
Dim result As SearchResult
search.Filter = "(SAMAccountName=" + username + ")"
search.PropertiesToLoad.Add("cn")
result = search.FindOne()
If result Is Nothing Then
Return False
End If
Catch ex As Exception
Return False
End Try
Return True
End Function
End Class