thomaseng
No Smoking , New Live !

导航

 

 

关键看最后一句,一定要设置 filterContext.Result

 public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);
            if (filterContext.HttpContext.Request["ticket"]==null)
            {
                //重定向
                 filterContext.HttpContext.Response.Redirect(@"http://localhost:46145/UserInfo/Login?src=" + filterContext.HttpContext.Request.Url.AbsoluteUri);
          //加了这句就不再走后面的Action
                 filterContext.Result =  new HttpNotFoundResult();
 
            }
        }

 

posted on 2013-03-24 16:36  thomaseng  阅读(1864)  评论(1编辑  收藏  举报