Reading Active Directory by VB.NET Source code...

Emc2

JF-Expert Member
Joined
Sep 26, 2011
Posts
16,808
Reaction score
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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…