I have the following Actions in Controller
public ActionResult Index(int? pageNumber)
public ActionResult Details(string seoFriendlyName)
And I want to have the following routes:
~/article/ -> Action = Index, pageNumber = 1
~/article/page-5 -> Action = Index, pageNumber = 5
~/article/page-1 -> ~/article/
~/article/foo -> Action = Details, seoFriendlyName = foo
I've tried to define the following routes, but it doesn't work:
routes.MapRoute(
null,
"article/page-{pageNumber}",
new { controller = "MyController", action = "Index", pageNumber = 1 },
new[] { "MyNamespace" }
);
routes.MapRoute(
null,
"article",
new { controller = "MyController", action = "Index", },
new[] { "MyNamespace" }
);
routes.MapRoute(
null,
"article/{seoFriendlyName}",
new { controller = "MyController", action = "Details", },
new[] { "MyNamespace" }
);
Any help would be greatly appreciated!