Exemplo n.º 1
0
        public void OnActionExecuting(ActionExecutingContext context)
        {
            userinfo uif = new userinfo();

            uif.pwd      = context.HttpContext.Request.Cookies["key"];
            uif.username = context.HttpContext.Request.Cookies["user"];
            WenZhangBLL bLL = new WenZhangBLL();

            if (!bLL.islogin(uif))
            {
                context.HttpContext.Response.Redirect("/user/login");
            }
            else
            {
            }
        }
Exemplo n.º 2
0
        public JsonResult islogin(userinfo uif)
        {
            WenZhangBLL uib = new WenZhangBLL();

            uif.pwd = jiami.Encrypt(uif.pwd);
            var data = uib.islogin(uif);

            if (data)
            {
                HttpContext.Response.Cookies.Append("key", uif.pwd);
                HttpContext.Response.Cookies.Append("user", uif.username);
                string backurl = HttpContext.Request.Cookies["backurl"];

                return(Json(new { issuf = true, msg = "登陆成功", backurl = backurl }));
            }
            else
            {
                return(Json(new { issuf = false, msg = "登陆失败" }));
            }
        }