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
Create a separate class,
public class RedirectingAction : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext context)
{
base.OnActionExecuting(context);
if (CheckUrCondition)
{
context.Result = new RedirectToRouteResult(new RouteValueDictionary(new
{
controller = "Home",
action = "Index"
}));
}
}
}
Then, When you create a controller, call this annotation as
[RedirectingAction]
public class TestController : Controller
{
public ActionResult Index()
{
return View();
}
}