Showing posts with label browser. Show all posts
Showing posts with label browser. Show all posts

Friday, March 16, 2012

Persistant cookie goes away....

I can successfully set the persistant cookie using RedirectFromLoginPage. I can close the browser and reopen it and yes, it uses the cookie.

But the cookie seems to still expire after the timeout period (default of 20 minutes). Why is this and how can I fix this?

Thanks in advance!

Ok the cookie stays there. But I am sent to the login page. So this line

If Context.User.Identity.IsAuthenticatedThen

is obviously telling me i'm not authenticated anymore. What am I missing?

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);
...