I am using the SqlRoleManager in a ASP.NET MVC 3 application, which works great. I recently enabled the cacheRolesInCookie option, which is clearly working in Firefox and Internet Explorer, but not in Chrome. In Fiddler, I am not even seeing the cookie coming back with the response in Chrome.
Here is what I have set in my Web.config:
<roleManager enabled="true" defaultProvider="SqlRoleManager" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieSlidingExpiration="false" cookieTimeout="5" createPersistentCookie="true" maxCachedResults="255">
<providers>
<add name="SqlRoleManager"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="aspnetConnectionString"
applicationName="RedactedNamespace.Web" />
</providers>
</roleManager>
As I mentioned, it works great in Firefox and IE, but not Chrome. Watching SQL Server Profiler, I can clearly see the first request in Firefox and IE will hit the database for the roles, then they are cached until the cookie expires. Chrome hits the database once for every request.
I am also using a SqlMembershipProvider and setting a cookie (manually) from the FormsAuthenticationTicket with no issues; the cookie works in all browsers.
In Firefox, the cookie is close to (but less than) 4096 bytes, and is HttpOnly.
How can I get the roles to cache in a cookie in Chrome?