<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New]Private Function ValidateActiveDirectoryLogin(ByVal Domain As String, ByVal Username As String, ByVal Password As String) As Boolean
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Dim Success As Boolean = False
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Dim Entry As New System.DirectoryServices.DirectoryEntry("LDAP://" & Domain, Username, Password)
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Try
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Success = Not (Results Is Nothing)
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Catch
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Success = False
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] End Try
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] Return Success
[/FONT]
<li style="font-family: 'Courier New',Courier,monospace; color: black; font-weight: normal; font-style: normal;">[FONT=Courier New] End Function [/FONT]