How to access the Forms Authentication Ticket in Authenticated pages
I have used the Forms Authentication for logging in and in that i have created the Forms Authentication Ticket and in that ticket i have passing the data with comma seperated values. how can i get the data which is in the ticke开发者_如何学Pythont to access in the Authenticated user pages
How can i do this?
Thanks & Regards, Vara Prasad.M
Request.Cookies[FormsAuthentication.FormsCookieName]
will give you the Forms Authentication cookie.
FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
will take that cookie and turn it into the FormsAuthenticationTicket.
From there you can access all sorts of properties. It sounds like you'll want Name and/or UserData.
You can follow this process from any place you can get an HttpRequest instance... which is pretty much everywhere.
精彩评论