quote:
Imports System.Data
Imports System.Data.SqlClient
Partial Class Dangnhap
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session.Item("Email") <> "" Then
Response.Redirect("~/DiaChiThanhToan.aspx")
End If
End Sub
Private Function ValidateUser(ByVal username As String, ByVal password As String)
Dim cn As SqlConnection = DBUtil.GetConnection
Dim cmd As New SqlCommand("Select Count(*) From KhachHang Where Email='" & userName & "' AND Matkhau='" & password & "'", cn)
Dim Count As Integer = cmd.ExecuteScalar
Return Count <> 0
End Function
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
If ValidateUser(Login1.UserName, Login1.Password) Then
Session.Item("Email") = Login1.UserName
Response.Redirect("~/DiaChiThanhToan.aspx")
End If
End Sub
End Class
http://tamnguyen.vn - Chúc các bạn thành công !