protected override void OnActionExecuting(ActionExecutingContext filterContext) { if (Request.Cookies["manage"] == null) {
//重置路由吧算是 filterContext.Result = RedirectToRoute("default", new { Controller = "Land", Action = "Index" }); } base.OnActionExecuting(filterContext); }
在网上看到其他的解决方案:
filterContext.HttpContext.Response.Redirect("") //只需要加上 filterContext.Result = new HttpUnauthorizedResult() //或者 filterContext.Result = new EmptyResult() //filter验证不通过就不会执行action了,