Inheritance: IIdentity
Exemple #1
0
 void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e)
 {
     HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
     if (authCookie != null)
     {
         string encTicket = authCookie.Value;
         if (!String.IsNullOrEmpty(encTicket))
         {
             FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encTicket);
             NerdIdentity id = new NerdIdentity(ticket);
             GenericPrincipal prin = new GenericPrincipal(id, null);
             HttpContext.Current.User = prin;
         }
     }
 }
        void MvcApplication_PostAuthenticateRequest(object sender, EventArgs e)
        {
            HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authCookie != null)
            {
                string encTicket = authCookie.Value;
                if (!String.IsNullOrEmpty(encTicket))
                {
                    FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(encTicket);
                    NerdIdentity     id   = new NerdIdentity(ticket);
                    GenericPrincipal prin = new GenericPrincipal(id, null);
                    HttpContext.Current.User = prin;
                }
            }
        }