How to redirect from OnActionExecuting in Base Controller?
问题 I have tried two ways: Response.Redirect() which does nothing, as well as calling a new method inside of the Base Controller that returns an ActionResult and have it return RedirectToAction()... neither of these work. How can I do a redirect from the OnActionExecuting method? 回答1: public override void OnActionExecuting(ActionExecutingContext filterContext) { ... if (needToRedirect) { ... filterContext.Result = new RedirectResult(url); return; } ... } 回答2: It can be done this way as well: