FormsAuthenticationTicket looses UserData
- From: "dev648237923" <dev648237923@xxxxxxxxxxxxxxx>
- Date: Fri, 1 Dec 2006 13:19:56 -0500
Upon logon I create a ticket and put some userdata in it:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
3, //Version
tUsername.Text, //Username
DateTime.Now, //Issue time
DateTime.Now.AddHours(1), //Expires every hour
false, //Don't persist cookie
"test data" //User_SecureID
);
//Hash the cookie for transport
string hash = FormsAuthentication.Encrypt(ticket);
cookie = new HttpCookie( FormsAuthentication.FormsCookieName, hash);
Response.Cookies.Add(cookie);
***Later on another aspx page I want to read that userdata but it alweays is
empty???
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;
string userData = ticket.UserData;
}
}
}
Any ideas on fixing this greatly appretiated!
.
- Follow-Ups:
- RE: FormsAuthenticationTicket looses UserData
- From: Walter Wang [MSFT]
- RE: FormsAuthenticationTicket looses UserData
- Prev by Date: Re: Is it possible to look at ASP.NET controls implementation?
- Next by Date: Re: Limit the length of databound text on datalist
- Previous by thread: Help - how to have email URL link start new session?
- Next by thread: RE: FormsAuthenticationTicket looses UserData
- Index(es):
Relevant Pages
|