MVC验证session是否过期,在每个action执行之前验证

        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            if (Session["wx_s_user"] == null)
            {
                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Login", action = "index" }));
            }

posted @ 2016-08-17 13:41  小A爱吧  阅读(807)  评论(0编辑  收藏  举报