コード例 #1
0
 public void SetPrincipal(Controller controller, ISession session)
 {
     var state = session.Serialize();
     var authTicket = new FormsAuthenticationTicket(1, "userNameGoesHere", DateTime.UtcNow, DateTime.MaxValue, true, state, "CallWallAuth");
     var encTicket = FormsAuthentication.Encrypt(authTicket);
     var faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
     controller.Response.Cookies.Add(faCookie);
 }