Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            shaoqi.BLL.Admin bll = new shaoqi.BLL.Admin();

            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.Admin model = bll.GetmodleByName(name);
                    if (model != null && model.Password == password)
                    {
                        //正确跳转到主页面  要将用户的信息添加到Session中
                        Session.Add("User", model);
                        Response.Redirect("/Admin/AdminMian.aspx");
                    }
                    else
                    {
                        msg = "帐号或者秘密错误";
                    }
                }
                else
                {
                    msg = "验证码输入错误";
                }
            }
        }
Пример #2
0
 protected string GetName(string id)
 {
     string sql = "select  top 1 Name from Admin where id=" + id;
     shaoqi.BLL.Admin adminBll = new shaoqi.BLL.Admin();
     return adminBll.GetName(sql);
 }