I've see this application which can dig out our User Name from somewhere and asks our password. To be on the safe side, I typed my wrong password and it could cross-check that it was a wrong password and it asked me to type the right password. My question is:
This function will authenticate a username and password against the active directory. You will need to import the System.DirectoryServices namespace. You'll also need to specify the LDAP path for the domain in the "domain" var, such as "dc=mydomain,dc=com".
Also, have a look at the My.User.* stuff.
Private Function Authenticate(userName As String, password As String, domain As String) As Boolean Dim authentic As Boolean = False Try Dim entry As New DirectoryEntry("LDAP://" & domain, userName, password) Dim nativeObject As Object = entry.NativeObject authentic = True Catch generatedExceptionName As DirectoryServicesCOMException End Try Return authentic End Function