protected void Page_Load(object sender, EventArgs e) { shaoqi.BLL.User bll = new shaoqi.BLL.User(); if (Request.Form["hidden"] != null) { //post发送过来的 string name = Request.Form["username"]; username = name; string password = Request.Form["password"]; string vail = Request.Form["yzm"]; string truevail = Session["vCode"].ToString(); if (vail == truevail) { shaoqi.Model.User model = bll.GetmodleByName(name); if (model != null && model.Password == password) { //正确跳转到主页面 要将用户的信息添加到Session中 Session.Add("Userinfo", model); Response.Redirect("/Users/index2.aspx"); } else { msg = "帐号或者秘密错误"; } } else { msg = "验证码输入错误"; } } else { action = Request.QueryString["action"]; } }
public String GetName(string id) { string sql = "select top 1 LoginName from [User] where id=" + id; shaoqi.BLL.User adminBll = new shaoqi.BLL.User(); return adminBll.GetName(sql); }