-2

how can i change the default route from home/index to area/controller/action

routes.MapRoute(
             null,
             "{area}/{controller}/{action}/{id}",
            "~/User/UserView/Index"
        );

is that wrong?

MethodMan
  • 18,625
  • 6
  • 34
  • 52

1 Answers1

0

if I understand correctly you want to change the default landing for routes. To do that you would implement something similar to this.

 routes.MapRoute(
            name: "Default",
            url: "{area}/{controller}/{action}/{id}",
            defaults: new {area = "User" ,controller = "UserView", action = "Index", id = UrlParameter.Optional }
        );

If you want this to take precedence over other routes make sure this is mapped before your other routes

Andrew Taylor
  • 72
  • 2
  • 9
  • The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: – Seymur Qanbarov Dec 15 '17 at 01:00
  • https://stackoverflow.com/questions/18273416/the-view-or-its-master-was-not-found-or-no-view-engine-supports-the-searched-loc – Andrew Taylor Dec 15 '17 at 01:07
  • That link above might help. I would need to see more of your code to fully understand such as the UserView controller and the index action. My guess is either you haven't created the view inside the proper folder inside the controller inside the area. – Andrew Taylor Dec 15 '17 at 01:09