I would like to create a route for my MVC page that looks like this:
/Articles/
/Articles/Page/2
/Articles/Page/3
I want the default page to be 1, but if the page is 1, then don’t actually show the /Page/ piece.
I started out with:
routes.MapRoute(
"Articles",
"Articles/Page/{page}",
new { controller = "Articles", action = "Index", page = 1 }
);
The problem with this is that when I do:
<%= Html.RouteLink("Articles", new { page = 1 }) %>
My route ends up being: /Articles/Page/
You might need two route definitions for this (untested):
and your controller action: