How to change url using url routing in mvc?

Total Post:26

 1212  View(s)
Rate this:

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.

  1. Post:28

    Re: How to change url using url routing in mvc?

    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 }

      Modified On Apr-09-2018 01:41:09 AM



Enter your email address here always to be updated. We promise not to spam!