I have a custom role provider for an ASP.NET MVC site which is retrieving the roles for a user using a PrincipalContext as below.
This works fine, except there is a long delay between changing groups in Active Directory and it appearing in the PrincipalContext.
The administrator can update groups through the site and would expect that to be visible immediately.
How can I avoid this delay? Is there a cache somewhere? A couple of hours of googling hasn't thrown up any solutions.
I do think this may be an environmental things, as my local machine does this immediately but the test server doesn't.
context = new PrincipalContext(ContextType.Domain, name, container, userName, _password))
var p = UserPrincipal.FindByIdentity(context, IdentityType.UserPrincipalName, username);
var groups = p.GetAuthorizationGroups();