.netmodel-view-controllerasp.net-mvc-2route-constraint

Does ASP.NET MVC have a Decimal route constraint baked in?


Does ASP.NET MVC have a decimal route constraint baked into the core library?

I know there's the Regex Constraint but I was wondering if there's any others?


Solution

  • I'm not aware of any, but it would be really easy to write your own. You just need to implement IRouteConstraint, which has a single Match method. Here is a blog post that explains it all in great detail.