private void login() { Dang_Nhap dn = new Dang_Nhap(); //Tạo một đối tượng mới cho lớp Dang_Nhap int t = dn.CheckLogin(username, Encrypt.EncryptText(password, true)); //gọi phương thức CheckLogin if (t > 0) { Session["UserName"] = username; Session["Role"] = t; //Response.Redirect("Login_Success.aspx"); } else { Response.Write("<script>alert('Đăng nhập tự động thất bại');</script>"); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Dang_Nhap dn = new Dang_Nhap(); //Tạo một đối tượng mới cho lớp Dang_Nhap int t = dn.CheckLogin(txtuser.Text, Encrypt.EncryptText(txtpass.Text, true)); //gọi phương thức CheckLogin if (t > 0) { Session["UserName"] = txtuser.Text; Session["Role"] = t; WriteCookie(); Response.Redirect("Login_Success.aspx"); } else { Response.Write("<script>alert('Đăng nhập thất bại');</script>"); } }