Which attribute would be used to enforce that a specific route parameter should be of type integer?

  • [Route]
  • [HttpGet]
  • [FromRoute]
  • [RegularExpression]
The [FromRoute] attribute is used to bind a route parameter to an action method parameter in ASP.NET Core. If you want to enforce that the parameter should be of a specific type, like integer, you can add the appropriate data type constraint in your action method's parameter using C# data type annotations.
Add your answer
Loading...

Leave a comment

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