15.5 Using Static URL Segments; Listing 15-14. Aliasing a Controller and an Action in the RouteConfig.cs File
parent
7e57cd2d16
commit
c4f05470ab
|
@ -103,6 +103,7 @@ namespace UrlsAndRoutes.Tests
|
||||||
TestRouteMatch("~/Customer", "Customer", "Index");
|
TestRouteMatch("~/Customer", "Customer", "Index");
|
||||||
TestRouteMatch("~/Customer/List", "Customer", "List");
|
TestRouteMatch("~/Customer/List", "Customer", "List");
|
||||||
TestRouteFail("~/Customer/List/All");
|
TestRouteFail("~/Customer/List/All");
|
||||||
|
TestRouteMatch("~/Shop/Index", "Home", "Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@ namespace UrlsAndRoutes
|
||||||
{
|
{
|
||||||
public static void RegisterRoutes(RouteCollection routes)
|
public static void RegisterRoutes(RouteCollection routes)
|
||||||
{
|
{
|
||||||
|
routes.MapRoute("ShopSchema2", "Shop/OldAction",
|
||||||
|
new { controller = "Home", action = "Index" });
|
||||||
|
|
||||||
routes.MapRoute("ShopSchema", "Shop/{action}",
|
routes.MapRoute("ShopSchema", "Shop/{action}",
|
||||||
new { controller = "Home" });
|
new { controller = "Home" });
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue