ASP.NET MVC: Redirect from One Controller Action to Another

Step1: Create an ASP.net MVC project.

MVC project

Choose ASP.Net MVC project from template and Press Next, then name the empty project as RoutingExample and click ok.

MVC project from template

Step 2: Add two controllers. I have added Home and Second in this example.

add controller

Step 3: Add this snippet in Index action of Home Controller to redirect to Second Controller action Index.

Second Controller action Index

Step 4: Choose default controller Home and default action Index in route config file.

config file

Step 5: Create a view for Index action of Second Controller by right clicking inside method.

add view

And add your custom message inside view. In this example I have added “This is second controller.”.

second controller

Step 6: Press F5 to run the solution.

solution