protected void Page_Load(object sender, EventArgs e) { if (Request.Form["username"] != null) { string LoginName = Request.Form["username"]; string LoginPassWord = Request.Form["userpwd"]; CarSpirits.BLL.Admin bll = new CarSpirits.BLL.Admin(); if (bll.Exists(LoginName, LoginPassWord)) { Response.Redirect("Index.aspx"); } } }
private string CheckLogin(string userName, string userPwd) { CarSpirits.BLL.Admin bll = new CarSpirits.BLL.Admin(); DataTable dt = bll.GetList("LoginName='" + userName + "' and PassWord='******'").Tables[0]; if (dt.Rows.Count > 0) { return("0");//登录成功 } else { return("1"); } }