Beispiel #1
0
        protected void Application_PostAuthenticateRequest()
        {
            HttpCookie authoCookies = Request.Cookies[FormsAuthentication.FormsCookieName];

            if (authoCookies != null)
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authoCookies.Value);
                JavaScriptSerializer      js     = new JavaScriptSerializer();
                User        user        = js.Deserialize <User>(ticket.UserData);
                MyIdentity  myIdentity  = new MyIdentity(user);
                MyPrincipal myPrincipal = new MyPrincipal(myIdentity);
                HttpContext.Current.User = myPrincipal;
            }
        }
Beispiel #2
0
 public MyPrincipal(MyIdentity _myIdentity)
 {
     MyIdentity = _myIdentity;
 }