Is there a custom role provider in ASP.Net for every user using Windows Authentication?

I wrote my own role provider for ASP.Net MVC. I am calling a WCF service to get the roles to authorize the current user. I am using Windows Authentication.

I want to store the current user roles in a variable for the role provider class, but it is not clear if the class is created per session or per application.

+2


source to share


2 answers


It is created once. A quick look at the docs confirmed this:



For each role provider specified in the application configuration, ASP.NET creates one instance of the provider role that is used for all requests made by the HttpApplication object. As a result, you can have multiple requests running at the same time. ASP.NET does not provide thread safety for your provider. You will need to write your provider code for it to stream safely. For example, creating a connection to a database or opening a file for editing must be done inside a member that is called, such as AddUsersToRoles, rather than opening a connection to a file or database when the initialization method is called.

+4


source


for each application



0


source







All Articles