I am developing a MVC 5 internet application, and I wish to redirect to a controller/action result from anywhere in my application.
The controller name is "Manager", and the action result is "TestAction"
In an action result, the following code can be used:
RedirectToAction("TestAction", "Manager")
I have also coded a filter attribute as follows:
filterContext.Result = new RedirectToRouteResult( new RouteValueDictionary{{ "controller", "Manage" }, { "action", "TestAction" } });
Is there a generic way to send the user to a specific controller, action result from anywhere in a MVC application? I specifically wish to do this in an extension method.
Thanks in advance.