15.6.2 Defining Optional URL Segments; Listinig 15-19. Specifying an Optional URL Segment in the RouteConfig.cs File
parent
b1390aba96
commit
e43c56e68a
|
@ -12,7 +12,7 @@ namespace UrlsAndRoutes
|
|||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.MapRoute("MyRoute", "{controller}/{action}/{id}",
|
||||
new { controller = "Home", action = "Index", id = "DefaultId" });
|
||||
new { controller = "Home", action = "Index", id = UrlParameter.Optional});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue