Which of the following best describes where you would apply the [Authorize] attribute?

  • Above the class definition for global authorization
  • Above the method that requires authorization
  • Within the Startup.cs file
  • In the web.config file
The [Authorize] attribute should be applied above the method that requires authorization. This means you place it directly above the action method within a controller where you want to restrict access. This approach allows for fine-grained control over which actions are protected and who can access them, ensuring security at the method level.
Add your answer
Loading...

Leave a comment

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