首页 > 代码库 > set .net principle

set .net principle

            var ticket = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.Minutes), true, JsonConvert.SerializeObject(userinfo), FormsAuthentication.FormsCookiePath);            HttpContext.Current.User = new GenericPrincipal(new FormsIdentity(ticket), null);            var hash = FormsAuthentication.Encrypt(ticket);            CookieHelper.SetCookie(FormsAuthentication.FormsCookieName, hash, FormsAuthentication.FormsCookiePath, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.Minutes), true, FormsAuthentication.RequireSSL);

  

set .net principle