Admin/Default.aspx沒寫完
阿新 • • 發佈:2019-01-08
Partial Class _Default Inherits System.Web.UI.Page Private sds As SqlDataSource = New SqlDataSource(Dao.ConnectionString, "select * from t_admin where adminname = @adminname and adminpass = @adminpass") Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate Dim adminname As String = Me.Login1.UserName.Trim().ToLower() '宣告字串變數username接收控制元件Login1的username屬性並過濾空格和變小寫 Dim adminpass As String = Me.Login1.Password.Trim().ToLower() Dim b As Boolean = Me.Login1.RememberMeSet If CType(sds.Select(DataSourceSelectArguments.Empty), System.Data.DataView)(0)(0).Equals("0") Then Session("adminname") = adminname Response.Redirect("~/Index.aspx") Return End If End Sub End Class