protected void Btn_Login_Click(object sender, EventArgs e) { BLL.UsersManager bllusersManager = new BLL.UsersManager(); string strWhere = "username='******'and password='******'"; DataSet ds = bllusersManager.GetList(strWhere); if (ds.Tables[0].Rows.Count > 0) { Session["userID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["username"] = txbUserName.Text.Trim(); // Session["password"] = ds.Tables[0].Rows[0]["userid"].ToString(); Response.Redirect("~/Users/Question.aspx"); return; } else { Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='UserLogin.aspx'</script>"); Response.End(); } }
protected void Button_submit_Click(object sender, EventArgs e) { BLL.UsersManager bllusersManager = new BLL.UsersManager(); // string strWhere "username ='******'and password='******'"; string strWhere = "username='******'and password='******'"; DataSet ds = bllusersManager.GetList(strWhere); if (ds.Tables[0].Rows.Count > 0) { Session["username"] = txbUserName.Text.Trim(); Session["password"] = ds.Tables[0].Rows[0]["userid"].ToString(); Response.Redirect("~/Default.aspx"); return; } else { Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='UserLogin.aspx'</script>"); Response.End(); } //BLL.AdminManager blladminManager = new BLL.AdminManager(); //string strWhere = "adminName='" + txbUserName.Text.Trim() + "' and adminPassword='******'"; //DataSet ds = blladminManager.GetList(strWhere); //if (ds.Tables[0].Rows.Count > 0) //{ // Session["adminName"] = txbUserName.Text.Trim(); // Session["adminPassword"] = ds.Tables[0].Rows[0]["ID"].ToString(); // Response.Redirect("~/Default.aspx"); // return; //} //else //{ // Response.Write("<script language=javascript>alert('用户名不存在或密码错误!');location.href='Login.aspx'</script>"); // Response.End(); //} }