terça-feira, junho 07, 2005

LDAP - User Validation

Public Function ValidateLDAPLogin(ByVal strUsername As String, ByVal strPassword As String, ByVal strLDAPServerIP As String) As String
Dim entry As New DirectoryEntry("LDAP://" & strLDAPServerIP & "/rootDSE", strUsername, strPassword, AuthenticationTypes.Secure)
Try
Dim strName As String = entry.Name ' PPI: This is one simple try, if failed, User isn't
Return ConfigurationSettings.AppSettings("strResponseOK")
Catch ex As System.Runtime.InteropServices.COMException
Return ex.Message
End Try
End Function