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.
Loading...
Related Quiz
- The MVC folder structure typically includes three main folders: Controllers, Views, and _________.
- Which of the following is essential for developing and running ASP.NET Core applications?
- If a developer is looking to quickly scaffold a new ASP.NET Core controller, which CLI command would they most likely use?
- You're trying to locate your application's main CSS files in an ASP.NET Core project. In which directory would you typically find them?
- In Razor forms, the _______ tag helper can be used to generate hidden input fields.