How to change url using url routing in mvc?

Hi I’m working with url routing.

My question is my actual controller is Home and action is Index when run application give the appropriate result that time url is Home/Index.

But I’m want to when type url Dashboard/Index that time execute Home controller index method.

How to possible.

Thank you in advance.

Last updated:2/21/2015 6:16:16 AM

1 Answers

Tom Cruser
Tom Cruser

Just add this route in RouteConfig.cs file make sure to add this before default route otherwise this is not work.

                 name: 'OldURL',
                 url: 'Dashboard/{action}/{id}',
                 defaults: new { controller = 'Home', action = 'Index', id = UrlParameter.Optional }