5
如何從自定義ActionFilter訪問RedirectToAction?從ActionFilter RedirectToAction
public class ExceptionHandlingFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
if (filterContext.Exception != null && !filterContext.ExceptionHandled)
{
filterContext.ExceptionHandled = true;
// HERE : RedirectToAction("ServiceNotFound","Error");
}
base.OnActionExecuted(filterContext);
}
}