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
| Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
strConnString = "Persist Security Info=False;Integrated Security=SSPI;database=ConsortiumDataBaseSQL;server=rcham-pc"
objConn.ConnectionString = strConnString
objConn.Open()
Dim intNumRows As Integer
strSQL = "SELECT COUNT(*) FROM dbo.compte WHERE loginUser = '" & Me.Login1.UserName.Trim & "' AND mdpUser = '" & Me.Login1.Password.Trim & "' "
objCmd = New SqlCommand(strSQL, objConn)
intNumRows = objCmd.ExecuteScalar()
If intNumRows > 0 Then
If retour(Me.Login1.UserName.Trim) = "administrateur" Then
Session("strUser") = Me.Login1.UserName.Trim
Response.Redirect("WebForm2.aspx")
End If
If retour(Me.Login1.UserName.Trim) = "utilisateur" Then
Session("strUser") = Me.Login1.UserName.Trim
Response.Redirect("WebForm3.aspx")
End If
End If
objConn.Close()
objConn = Nothing
End Sub |
Partager