15.5 Using Static URL Segments; Listing 15-12. A URL Pattern with a Mixed Segment in the RouteConfig.cs File

chap15
Jason Zhu 2021-11-23 11:59:50 +11:00
parent 981ebcaf47
commit 2ea5c23a4d
1 changed files with 2 additions and 0 deletions

View File

@ -11,6 +11,8 @@ namespace UrlsAndRoutes
{ {
public static void RegisterRoutes(RouteCollection routes) public static void RegisterRoutes(RouteCollection routes)
{ {
routes.MapRoute("", "X{controller}/{action}");
routes.MapRoute("MyRoute", "{controller}/{action}", routes.MapRoute("MyRoute", "{controller}/{action}",
new { controller = "Home", action = "Index" }); new { controller = "Home", action = "Index" });