Apart from the above, there are few more like regex, maxlength, minlength, I am not going to discuss about these as these are as clear as their names.

Creating Custom Route Constraints

There are many Route constraints available (as discussed in the preceding code), but there might be scenarios, where we need some special kind of constraints. To fulfill those requirements, we can create our own constraints.

In the very first step for creation of Custom Route Constraints, we need to implement interface IHttpRouteConstraint.

I am taking an example of my live project where we have to restrict bad-words: