I have mapped route:
routes.MapRoute("test", "/{p1:int}-{p2}", new { controller = "test", action = "int" });
Such route should match int-string, like /1-stuff
, and it works for such cases, however it does not work for /1-stuff-stuff
. I guess this is because route is matched and then params are rejected because of int constraint.
If I remove constraints p1
equals 1-stuff
, and p2
equals stuff
. Is there way to apply constraints in correct way or to mark p2 as "greedy" (but not catch-all), so p1
equals 1
and p2
equals stuff-stuff
?
This is very important for making human-firendly urls, where ids are at front and everything is kebab case without additional characters.
Catch-all does not work for me I need p2 to be bound to action parameter. Regex does not help.