User1140095199 posted
Hi,
Greetings!
I've written a custom role provider, but it is initializing to soon..
Could you elaborate more on what you mean by "initializing too soon".
The way I look to it is cacheRolesInCookie is set to
true .
<roleManager
defaultProvider="CustomRoleProvider"
enabled="true"
cacheRolesInCookie="true">
When you set it to true in the Web.config file, role information for each user is stored in a cookie. When role management checks to see whether a user is in a particular role, the roles cookie is checked before the role provider is called to check
the list of roles at the data source. The cookie is dynamically updated to cache the most recently validated role names.
So , it might be the case it is getting the values from the Cookie. Hence, you are getting the impression that it is getting initialized too soon.
For more reference -
http://msdn.microsoft.com/en-us/library/system.web.security.roles.cacherolesincookie(v=vs.110).aspx
Do get back with more information if I am missing a point here.
Hope it helps!
Best Regards!