我試圖實現路由有問題,如下列:與MVC路由
帖子/ 535434 /這 - 是 - 一 - 後標題
posts/tagged/tags+here
// Matches {controller}/{action}/{id} - Default
// Displays all posts with the specified tags
// uses PostsController : ActionTagged(string tags)
posts?pageSize=50&pageIndex=4
// Matches {controller}/{action}/{id} - Default
// Displays all posts
// uses PostsController : Index(int? pageSize, int? pageIndex)
這是我想的問題這樣做:
posts/39423/this-is-a-post-title-here
// Typically this is implemented using an action like 'Details'
// and would normally look like : posts/details/5
我似乎無法得到路由工作的權利。我想是這樣的:
{controller}/{id}/{description}
並設置默認操作爲「顯示」的作品,但後來也不會允許我導航到像「標記」等命名的動作。
我錯過了什麼?
謝謝!
好的答案。雖然問題。我需要在IRouteContraint中做些什麼?我從來沒有用過它,你能否再解釋一下。 – Micah 2009-02-06 13:06:10