我在控制器中有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