Friday, March 16, 2012

persistent cookies

Hi

I could not understand FWIW persistent cookies checkbox
I was logged in, cookie was already recorded but after closing and opening browser I'm still being redirected to sigin.aspx page

any help would be appreciated

Is it possible to post your Login Code where the cookie is being made ?

sure, thanks
// Create a new ticket used for authentication
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // Ticket version
Username.Value, // Username associated with ticket
DateTime.Now, // Date/time issued
DateTime.Now.AddMinutes(30), // Date/time to expire
true, // "true" for a persistent user cookie
reader.GetString(0), // User-data, in this case the roles
FormsAuthentication.FormsCookiePath);// Path cookie valid for
Also I'm doing this into login button event handler:
...
FormsAuthentication.SetAuthCookie(txtUsername.Text, checkRemember.Checked);
...

0 comments:

Post a Comment