15.5 Using Static URL Segments; Listing 15-11. A URL Pattern with Static Segments in the RouteConfig.cs File

chap15
Jason Zhu 2021-11-23 11:52:55 +11:00
parent 6112f51510
commit 981ebcaf47
1 changed files with 4 additions and 1 deletions

View File

@ -12,7 +12,10 @@ namespace UrlsAndRoutes
public static void RegisterRoutes(RouteCollection routes) public static void RegisterRoutes(RouteCollection routes)
{ {
routes.MapRoute("MyRoute", "{controller}/{action}", routes.MapRoute("MyRoute", "{controller}/{action}",
new { controller = "Home", action = "Index"}); new { controller = "Home", action = "Index" });
routes.MapRoute("", "Public/{controller}/{action}",
new { controller = "Home", action = "Index" });
} }
} }
} }