I have custom RoleProvider. I see that GetRolesForUser() getting called for each session even if the user auto-logged in via cookie.
99.99% of the users will have just one role 'USER' (app is public) and their roles won't change.
So I want the roles to be cached in Roles cookie so that GetRolesForUser() not called for each session.
I have this in my web.config:
<roleManager enabled="true" defaultProvider="MyRoleProvider" cacheRolesInCookie="true" cookieName="MyRoles" cookieSlidingExpiration="true" cookieTimeout="60" createPersistentCookie="true" >
<providers>
<clear/>
<add connectionStringName="MyConnection" applicationName="MyApp" name="MyRoleProvider" type="My.Data.Security.MyRoleProvider"/>
</providers>
</roleManager>
I see the Roles cookie saved in the same cookie file which has login info. Not sure if that is right or not.
But I still see GetRolesForUser() getting called for each new session.
What I am missing?