컨트롤러에 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" });
은 내가 트릭을 할 것입니다 그들에 넣어 제약을 생각 요청은 모두 첫 번째 경로를 통해 전송됩니다. 내가 도대체 뭘 잘못하고있는 겁니까?
주위의 두 경로를 전환하십시오 ... –