Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static HttpCookie BuildCookie(int userprofileId)
- {
- FormsAuthentication.Initialize();
- FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
- 1,
- userprofileId.ToString(CultureInfo.InvariantCulture),
- DateTime.Now,
- DateTime.Now.AddMinutes(30),
- false,
- UserprofileRole.GetStringByUserprofile(userprofileId),
- FormsAuthentication.FormsCookiePath);
- string hashedTicket = FormsAuthentication.Encrypt(ticket);
- HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashedTicket);
- return cookie;
- }
Advertisement
Add Comment
Please, Sign In to add comment