simple question…
Given I have an ASP.NET site, which uses a [custom] RoleProvider,
Is there any way in which I can somehow “refresh” the provider without forcing the user to log out of the site and log back in?
I’m looking for something that would be akin to a fictional method
Roles.Refresh()
Specifically, I am looking at this for if an administrator changes a user’s roles, the user sessions could maybe refresh themselves every 10 minutes or something.
I assume you have something like this in your
web.config:The roles are cached in a cookie , so you can force them to refresh by deleting the cookie. This method worked for me. I added the
cookieNameattribute so that I don’t rely on asp.net’s default. For your scenario, though, you may be able to just set thecookieTimeoutattribute to something reasonable and be done with it.This method won’t update the roles immediately, of course. They will be updated on the next page load after you delete the cookie.