- It allows you to restrict the parameters in the route template are matched
- The syntax is {parameter:constraint}
PetController.cs
public class PetController : Controller
{
Key points of the above code
- In the above example, /Pet/8 will Route to the “GetSpecificPetById” Action.
- Here the route will only be selected, if the “petId” portion of the URI is an integer.
Add comment