Imagine you have two route templates: /products/{id} and /products/new. An incoming request has the URL /products/new. Which route will it match and why?

  • /products/{id}
  • /products/new
  • It will not match any route
  • /products/{action}
ASP.NET Core routing uses a first-match-wins strategy. In this case, the incoming request "/products/new" matches the second route "/products/new" exactly. Therefore, it will not proceed to check other routes and will be handled by the "/products/new" route.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *