我有一個名爲區域MyArea和它的登記,像這樣:ASP.Net MVC路線問題
context.MapRoute(null, "MyArea", new { controller = "MyAreaController", action = "Index" });
//Properties
context.MapRoute(null, "MyArea/properties", new { controller = "Property", action = "Index" });
context.MapRoute(null, "MyArea/properties/edit/{propertyId}", new { controller = "Property", action = "Property" });
//Units
context.MapRoute(null, "MyArea/properties/edit/{propertyId}/units/{unitId}", new { action = "Unit", propertyId = 1, unitId = 1 });
它應該是一個酒店有很多單位,所以我想我的網址看起來是這樣的:
http://localhost:50182/myarea/properties/edit/4/units/1
我使用的Html.ActionLink的代碼如下所示:
@Html.ActionLink("Add new Unit", "Unit", "Unit", new { propertyId = 1, unitId = 1 })
我有一個單位控制器與一個稱爲單位的行動。請幫助,我錯過了什麼?
謝謝!
你面臨什麼問題? – 2011-03-29 13:46:59
鏈接轉到http:// localhost:50182/myarea/properties/edit/4/units?controller = Property&Length = 4 而不是: http:// localhost:50182/myarea/properties/edit/4/units/1 我收到以下錯誤消息: 值不能爲空或爲空。 參數名稱:controllerName – Pete 2011-03-29 13:50:19