I'm trying to add custom URL to my application. For example, I have a report section and I want all the Controller in that section to start with "Report". Currently, my URL look like :
localhost:12345/MyReport
but I want it to look like
localhost:12345/Report/MyReport
MyReport is the name of my controller.
I tried to change the following code in Global.asax
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
By
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
"Report",
"Report/{controller}/{action}/{id}",
new { controller = "MyReport", action = "Index", id = UrlParameter.Optional }
);
But I get a page not found error when I try to access localhost:12345/Report/MyReport... Any clue?