I am storing user details with form authentication cookie.
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, userName,DateTime.Now,DateTime.Now.AddMinutes(Timeout)false};
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie authCookie = new HttpCookie(
FormsAuthentication.FormsCookieName,encryptedTicket);
HttpContext.Current.Response.Cookies.Add(authCookie);
How can I get back the added cookie and user detail (authTicket)?
You can retrieve the
FormsAuthenticationTicketusing code similar to the following:The above code makes reference to things like
txtUserName.Text, so here’s a complete .ASPX page that you can paste into an empty ASP.NET webform to see how it works: