1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
Public Shared Function Authentifier(ByVal strUtilisateur As String, ByVal strMotDePasse As String) As Boolean
Dim bOk As Boolean = False
' Cryptage du mot de passe
strMotDePasse = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strMotDePasse, "MD5")
Dim request As String = "SELECT * FROM Utilisateurs WHERE Login='" + strUtilisateur + "'"
Dim command As OleDbCommand = New OleDbCommand(request)
command.Connection = adobasic.myConnection
Dim reader As OleDbDataReader = command.ExecuteReader
Try
Dim row As Object() = Nothing
While reader.Read
If row Is Nothing Then
row = New Object(reader.FieldCount) {}
End If
reader.GetValues(row)
Dim i As Integer = 0
If (row.GetLength(0) = 0 And row(0) Is Nothing) Then
reader.Close()
Return False
Else
If (row(4).ToString = strMotDePasse) Then
reader.Close()
Return True ---> je passe par ici, donc return TRUE, mais redirection ne marche pas.....
End If
End If
End While
reader.Close()
Catch ex As OleDbException
'MsgBox(ex.ToString)
reader.Close()
Return False
End Try
End Function |