Guest User

Untitled

a guest
Jul 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. FormsAuthenticationTicket tkt;
  2. string cookiestr;
  3. HttpCookie ck;
  4. tkt = new FormsAuthenticationTicket(1, _user.User_Id.ToString(), DateTime.Now,
  5. DateTime.Now.AddMinutes(60), true, string.Format("{0},{1}", System.DateTime.Now.ToString(), _user.User_Id.ToString()));
  6. cookiestr = FormsAuthentication.Encrypt(tkt);
  7. ck = new HttpCookie(FormsAuthentication.FormsCookieName, cookiestr);
  8. ck.Path = FormsAuthentication.FormsCookiePath;
  9. Response.Cookies.Add(ck);
Add Comment
Please, Sign In to add comment