0
似乎我仍然錯過了MVC路由概念。我有一條路線跟隨某個地區的另一條路線幾乎相同的模式,但由於我每次嘗試運行它時都會收到404的原因。我嘗試過使用Phil Haack的路由測試器DLL,並根據它命中正確的路由(匹配路由出現在common/itemhistory/{contentid}中)。當我試圖真正運行它時,它會爆炸。MVC中不一致的路由結果
我想通過傳遞Guid將調用映射到JsonResult。我已經成功地與其他路線正常工作(通常是我的網站的一個區域)。
我會做什麼錯?
context.MapRoute(
"ItemHistory",
"common/itemhistory/{contentid}",
new { controller = "common", action = "GetItemHistory" },
new { contentid = @"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" }
);
context.MapRoute(
"Common_default",
"common/{action}",
new { controller="common", action = "Index" }
);
唉唉!我知道這是明顯的。我想我一直在看這個東西太久了。接得好。 – HapiDjus 2011-01-12 22:14:12