I got a pretty basic ASP.NET MVC (1) routing qeustion but I couldn't find an answer by now.
I want to call an action method which has three parameters but I'm running into an 404 when I call it with more than one parameter.
Route looks like this (I removed all other routes but the default one):
routes.MapRoute(
"Test",
"{id}/{page}/{lineend}",
new { controller = "Basic", action = "Test" },
new { id = @"\d+", page = @"\d+" }
);
The method looks like this:
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Test(int? id, int? page, string lineend)
{
// some code here
return new ViewResult();
}
This is what happens:
http://localhost:55462/Basic/Test/
works
http://localhost:55462/Basic/Test/1
works
http://localhost:55462/Basic/Test/1/2
gives a 404
http://localhost:55462/Basic/Test/1/2/3
gives a 404
Removing the constraints or changing the method signature to (int, int, string) has the same effect. In the first and second case the application complains about a null parameter, the other cases lead to a 404.
I know this issue has to be pretty basic but I just don't get it.
Thanks for your help!