| Constraint | Description | Example | 
|---|---|---|
| alpha | Matches uppercase or lowercase Latin alphabet characters (a-z, A-Z) | {x:alpha} | 
| bool | Matches a Boolean value. | {x:bool} | 
| datetime | Matches a DateTime value. | {x:datetime} | 
| decimal | Matches a decimal value. | {x:decimal} | 
| double | Matches a 64-bit floating-point value. | {x:double} | 
| float | Matches a 32-bit floating-point value. | {x:float} | 
| guid | Matches a GUID value. | {x:guid} | 
| int | Matches a 32-bit integer value. | {x:int} | 
| length | Matches a string with the specified length or within a specified range of lengths. | {x:length(6)}  {x:length(1,20)}  | 
| long | Matches a 64-bit integer value. | {x:long} | 
| max | Matches an integer with a maximum value. | {x:max(10)} | 
| maxlength | Matches a string with a maximum length. | {x:maxlength(10)} | 
| min | Matches an integer with a minimum value. | {x:min(10)} | 
| minlength | Matches a string with a minimum length. | {x:minlength(10)} | 
| range | Matches an integer within a range of values. | {x:range(10,50)} | 
| regex | Matches a regular expression. | {x:regex(^\d{3}-\d{3}-\d{4}$)} | 
Route Constraints Supported in Attribute Routing in ASP.NET MVC 5 | ASP.NET MVC Tutorial
Route constraints let you restrict how the parameters in the route template are matched. The general syntax is {parameter:constraint}. The following table lists the constraints that are supported in Attribute Routing in ASP.NET MVC 5
Popular Tutorials
- Creating Cookie in ASP.NET MVC Action | Handling Cookies in ASP.NET MVC | Set Cookie Expiry in ASP.NET MVC | ASP.NET MVC Tutorial
 - Generating Multiline TextBox or TextArea with @Html.EditorFor in ASP.NET MVC
 - Generating Unique Token in C# | Generating Unique Token that Expires after 24 Hours in C# | C# Tutorial
 - Drag & Drop File Upload In ASP.NET MVC Using dropzone js with Fallback Browser Support | ASP.NET MVC Tutorial
 - Loading PartialView Via JQuery In ASP.NET MVC | Returning PartialView From ASP.NET MVC Action | ASP.NET MVC Tutorial
 - How To Enable Role Manager Feature In ASP.NET MVC? | ASP.NET MVC Interview Question
 - How To Add CSS Class And Custom Property in Html.TextBoxFor? | ASP.NET MVC | RAZOR
 - Send and Receive SMS and MMS Messages Using Android 4.4 SMS API | Android Video Tutorial
 - How to Get Browser Agent from ASP.NET Web API Controller? | ASP.NET Web API Tutorial
 - Difference Between Html.Partial vs Html.RenderPartial & Html.Action vs Html.RenderAction | ASP.NET MVC Tutorial