To redirect, override, OnActionExecutingand assign a new RedirectToRouteResultto filterContext.Result:
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.Result = new RedirectToRouteResult(
new RouteValueDictionary { { "action", "newActionName" },
{ "actionArgument", someData } });
}
To assign data when redirecting, put it in the route as shown above.
source
share