//this method is used to validte the user name or password of the user after verfiying the both the control will transfer to another page public ActionResult Login(AdminLogin log) { AdminLogin obj_Login = new AdminLogin(); String query = "select * from AdminLogin where UserName='******' and UserPassword='******'"; DataTable tbl = new DataTable(); tbl = obj_Login.Login(query); if (tbl.Rows.Count > 0) { return(View("Dashboard")); } else { return(View("Invalid")); } }
public ActionResult Login(AdminLogin login) { //Pass the data to store the record into the table DataTable tbl = new DataTable(); tbl = login.Login("select * from Login where LoginName='" + login.QName + "'and LoginPassword='******'"); if (tbl.Rows.Count > 0) { return(View("ValidLogin")); } else { return(View("InvalidLogin")); } }
protected void btnLogin_Click(object sender, EventArgs e) { this.txtUsername.Visible = false; this.txtPassword.Visible = false; this.btnLogin.Visible = false; this.Label1.Visible = true; string name = this.txtUsername.Text.ToString(); string pwd = txtPassword.Text.ToString(); bool b = AdminLogin.Login(name, pwd); if (b) { Session["admin"] = "admin"; this.Label1.Text = "see you again!"; this.pnLogin.Visible = true; } else { this.Label1.Text = "登陆失败!"; this.btnRevLogin.Visible = true; } }