The below code is for the LDAP authentication.
Private Function ValidateActiveDirectoryLogin(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.DirectoryEntry("LDAP://" & Domain, Username, Password)
Dim Searcher As New System.DirectoryServices.DirectorySearcher(Entry)
Searcher.SearchScope = DirectoryServices.SearchScope.OneLevel
Try
Dim Results As System.DirectoryServices.SearchResult = Searcher.FindOne
Success = Not (Results Is Nothing)
Catch
Success = False
End Try
Return Success
End Function
Pass the required variable s as below
If ValidateActiveDirectoryLogin("DOMAINNAME", Login1.UserName, Login1.Password) Then
Label1.Text = "Pass"
Else
lbl_msg.Text = "Login Failed"
End If
The above code is quite fast, I dont think you would require to store it in XML and moreover, most of the ActiveDirectory services use a password expiration, so if security is a concern then authenticate on every login.