Hi,
I need help with a constraint:
Constraints = new RouteValueDictionary(new { filename = @"" })
It has to be only numeric (no letters, slashes etc).
Hi,
I need help with a constraint:
Constraints = new RouteValueDictionary(new { filename = @"" })
It has to be only numeric (no letters, slashes etc).
I'm not sure I understood the question, but as far as I know, you can simply provide regular expressions in the Constraints dictionary.
I think there is even an example for that in the MSDN refguide:
reportRoute.Constraints = new RouteValueDictionary {
{ "locale", "[a-z]{2}-[a-z]{2}" },
{ "year", @"\d{4}" } };
based on that, I think what you have to write:
Constraints = new RouteValueDictionary(new { filename = @"\d+" })