码迷,mamicode.com
首页 > Web开发 > 详细

set .net principle

时间:2017-01-22 16:56:03      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:null   current   cookie   setcookie   hash   ticket   div   sha   icp   

            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

标签:null   current   cookie   setcookie   hash   ticket   div   sha   icp   

原文地址:http://www.cnblogs.com/hualiu0/p/6340454.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!