我在控制器中有3個動作。我想前兩個是/posts/new
,最後是/posts/{filter}?page=N
爲什麼我的路線不符合預期?
//all are in the PostsController
[HttpGet]
public ActionResult New()
[HttpPost]
public ActionResult New(PostView post)
[HttpGet]
public ActionResult Browse(string filter, int page)
我現在已經定義的路線是:
routes.MapRoute("BrowsePosts",
"posts/{filter}",
new { controller = "posts", action = "browse", filter = "", page = 1 },
new { controller = "posts", action = "browse", page = @"\d+" });
routes.MapRoute("NewPost",
"posts/new",
new { controller = "", action = "" },
new { controller = "posts", action = "new" });
我以爲我把他們會做的伎倆約束,但這些請求都是通過第一條路線發送的。我究竟做錯了什麼?
切換兩條路線...... – 2011-12-29 01:15:21