No, you don't need to do that. Just add the following to you're registered route: .../{currentPageNumber}. Now you can have a parameter on you're controller with the same name.
Thank you Jonas!
It worked like a charm! However I need to add a ParameterSegment to the MapContentRouteParameters to make it work:
var parameters = new MapContentRouteParameters
{
SegmentMappings = new Dictionary<string, ISegment>(),
Direction = SupportedDirection.Both
};
var pageNumberParameter = new ParameterSegment("currentPageNumber");
routes.MapContentRoute(
name: "pagenumber",
url: "{currentPageNumber}/{node}/{action}",
defaults: new { action = "index" },
parameters: parameters);
By the way, I have another question, is there anyway to hide the parameter in the url, I have another parameter, but dont want to show it in the url, how can I do that?
Regards,
Hai
Hi,
I need to rewrite the default routing to my custom url structure, with help from EPiServer Devs I am able to make it work as expect. However, I have a paging which I want the URL to something like Mydomain.com/structure/2/ 2 is the page number here but it shows me Mydomain.com/structure?currentpagenumber = 2, do I need to write a new segment for currentpagenumber?
Thanks in advance,
Hai