How can you define a route in ASP.NET Core to be available only for specific HTTP methods using attribute routing?
- [HttpPut], [HttpPost]
- [HttpGet], [HttpPost]
- [HttpDelete], [HttpGet]
- [HttpPatch], [HttpPut]
In ASP.NET Core, you can specify the HTTP methods a route should be available for using attributes like [HttpGet] or [HttpPost] above the controller action method. For example, [HttpGet] ensures the route is available for HTTP GET requests, and [HttpPost] for HTTP POST requests.
Loading...
Related Quiz
- When combining multiple [Authorize] attributes on a single action or controller, how does ASP.NET Core evaluate the requirements?
- The ________ folder in an ASP.NET Core MVC project typically contains the shared Razor views like layout and error pages.
- How does the ASP.NET Core MVC determine which controller and action to route a request to?
- When securing ASP.NET Core applications, the ________ attribute can be applied to ensure certain actions or controllers are accessible only to authenticated users.
- In a project review, you noticed that the production database connection string is exposed in appsettings.json. How should you securely manage this connection string in an ASP.NET Core application?