sql server - Does asp.net do any caching when checking for [Authorize(Roles = "Student")] -


I have a way that I want to limit the use of people to the role of "student". I want to find different ways of doing this.

I first know that I can decorate the method like this:

  [authorized (role = "student")]  

I know that the role of role 4 is "Student" and if I know that user has 2 user ID then:

The decoration of this method is more efficient Allow each user to join the role, and then select my identity against 2 databases to see it. A. That's a part of 4 AspNetUserRoles table User 2.

As a FYI I am using WebAPI with ASP.NET ID 2.1 and Token carrier authentication. All my users use the web browser through front-end if there is no caching but there is a way to switch to caching, then I would appreciate any advice from anyone who can give me advice on how to use it. It is not enabled by default if it is by default. CacheRolesInCookie

You can enable the role provider's caching feature from web.config

Code>. See for more information.

Alternatively, you can always override the default role provider (see for more information), but I think this is not really what you are looking for ...


Comments