I have an action in a controller with the following route defined.
[Route(@"mycontroller/myaction/{itemId:int}-{itemSlug}"]
public ActionResult MyAction(int itemId, string itemSlug) {
...
}
It works and hits the action with proper parameters if the itemSlug
itself does not contain a dash, but if it does, the route doesn't get hit. I don't udnerstand it, because in my opinion the correct behaviour would be to leave the rest of the dashes and process them as part of itemSlug
if I constrain the part before the first dash to be integer.
How to overcome this issue? I would'nt like to use a different character to separate itemId
and itemSlug
.