15.6.3 Defining Variable-Length Routes; Listing 15-23. Designating a Catchall Variable in the RouteConfig.cs File

chap15
Jason Zhu 2021-11-24 19:11:59 +11:00
parent 488ab5bfac
commit b9dc70e649
1 changed files with 1 additions and 1 deletions

View File

@ -11,7 +11,7 @@ namespace UrlsAndRoutes
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapRoute("MyRoute", "{controller}/{action}/{id}",
routes.MapRoute("MyRoute", "{controller}/{action}/{id}/{*catchall}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional});
}
}