Hi
Where below information gets saved
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket version
UserId, // Username associated with the ticket
DateTime.Now, // Date/time issued
DateTime.Now.AddMinutes(30), // Date/time to expire
false, // Persistent user cookie
"UserRole", // User data (e.g., role, other info)
FormsAuthentication.FormsCookiePath); // Cookie path
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
HtpCookie authCookie = new HtpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
HtpContext.Current.Response.Cookies.Add(authCookie);
Thanks
Amit MohantyPosted Aug 20, 2024, 8:06 AM
The user information (like UserId, UserRole, etc.) is encrypted and stored in the authentication cookie on the client-side (browser). On each request, this cookie is sent back to the server, where it is decrypted and used to authenticate the user.
So, the ticket information is stored within the cookie on the client's machine, and the encrypted data is used to maintain user authentication across requests.