关键看最后一句,一定要设置 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(); } }