Code đăng nhập ASP.NET bằng VB.net pdf

2 735 0
Code đăng nhập ASP.NET bằng VB.net pdf

Đang tải... (xem toàn văn)

Thông tin tài liệu

Code đăng nhập ASP.NET bằng VB.net (Thứ Ba, 29/12/2009-11:00 AM) Giao diện cùng code đăng nhập ASP.NET bằng VB.net. Còn dưới đây là code: 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 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 . Code đăng nhập ASP. NET bằng VB .net (Thứ Ba, 29/12/2009-11:00 AM) Giao diện cùng code đăng nhập ASP. NET bằng VB .net. Còn dưới đây là code: quote: Imports System.Data. Session.Item("Email") <> "" Then Response.Redirect("~/DiaChiThanhToan.aspx") End If End Sub Private Function ValidateUser(ByVal username As String, ByVal. Session.Item("Email") = Login1.UserName Response.Redirect("~/DiaChiThanhToan.aspx") End If End Sub End Class Imports System.Data Imports System.Data.SqlClient Partial

Ngày đăng: 29/07/2014, 06:20

Tài liệu cùng người dùng

Tài liệu liên quan