1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
if (System.Web.HttpContext.Current.Request.IsAuthenticated)
{
System.Security.Principal.WindowsIdentity identity = (System.Security.Principal.WindowsIdentity)this.Context.User.Identity;
this.Context.Cache.Remove(this.Context.User.Identity.Name);
// Test l'existence d'un user en cache
if (this.Context.Cache[identity.Name] == null)
{
// récupération des informations de sécurité en base (Profil)
CustomPrincipal principal = AuthentificationManager.CreateCustomPrincipal(identity);
// et Mise en cache des informations de sécurité
Context.Cache.Add(identity.Name, principal, null, DateTime.MaxValue, new TimeSpan(0, 20, 0), CacheItemPriority.Normal, null);
}
}
} |
Partager