【发布时间】:2015-08-08 22:05:33
【问题描述】:
我有一个网站来管理餐馆的库存。这些是我的路线:
routes.MapRoute(
"Inventory",
"Inventory/{restaurantName}/{restaurantLocationId}/{code}",
new { controller = "Inventory", action = "Index" },
new[] { "MySite.Web.Controllers" }
);
routes.MapRoute( // this route doesn't work
"ListRestaurantInventory",
"Inventory/List/{restaurantLocationId}/{code}",
new { controller = "Inventory", action = "ListRestaurantInventoryItems" },
new[] { "MySite.Web.Controllers" }
);
routes.MapRoute(
"InventoryDetails",
"Inventory/{restaurantName}/{restaurantLocationId}/{code}/Details/{restaurantInventoryItemId}",
new { controller = "Inventory", action = "Details" },
new[] { "MySite.Web.Controllers" }
);
问题在于ListRestaurantInventory 路线,如果我尝试导航到/Inventory/List/1/ABC,我会得到404。我的其他路线运行良好。
我真的不知道我的路线有什么问题。我是否需要更改路由顺序或 URL 中参数的顺序?
【问题讨论】:
标签: asp.net-mvc routes url-routing asp.net-mvc-routing