Upon logon I create a ticket and put some userdata in it:
FormsAuthentica tionTicket ticket = new FormsAuthentica tionTicket(
3, //Version
tUsername.Text, //Username
DateTime.Now, //Issue time
DateTime.Now.Ad dHours(1), //Expires every hour
false, //Don't persist cookie
"test data" //User_SecureID
);
//Hash the cookie for transport
string hash = FormsAuthentica tion.Encrypt(ti cket);
cookie = new HttpCookie( FormsAuthentica tion.FormsCooki eName, hash);
Response.Cookie s.Add(cookie);
***Later on another aspx page I want to read that userdata but it alweays is
empty???
if (HttpContext.Cu rrent.User != null)
{
if (HttpContext.Cu rrent.User.Iden tity.IsAuthenti cated)
{
if (HttpContext.Cu rrent.User.Iden tity is FormsIdentity)
{
FormsIdentity id = (FormsIdentity) HttpContext.Cur rent.User.Ident ity;
FormsAuthentica tionTicket ticket = id.Ticket;
string userData = ticket.UserData ;
}
}
}
Any ideas on fixing this greatly appretiated!