I just can't get my head round persistent cookies when using FormsAuthentication so I hope someone can help. Basically I have a login screen, and I want to create a persistent cookie which holds a few properties of the user, specifically their name, userID and access level. It doesn't matter what I do, my cookies always expire at session end. For example, after authenticating the login I'm using the following code...
This should create a persistent cookie. But if I close the browser and re-open it then Context.Request.IsAuthenticated returns false. How can I make a login persiste across sessions? What I'm looking for is direction to a decent tutorial to explain all this stuff, because I can find endless tutorials about the simple authentication and redirection process with FormsAuthentication, but nothing about how to maintain a persistent cookie or add information to the cookie that is created with the GetRedirectUrl method.
Any advice is appreciated.
Tom
Code:
Response.Redirect(FormsAuthentication.GetRedirectUrl(txtUser.Text, true));
This should create a persistent cookie. But if I close the browser and re-open it then Context.Request.IsAuthenticated returns false. How can I make a login persiste across sessions? What I'm looking for is direction to a decent tutorial to explain all this stuff, because I can find endless tutorials about the simple authentication and redirection process with FormsAuthentication, but nothing about how to maintain a persistent cookie or add information to the cookie that is created with the GetRedirectUrl method.
Any advice is appreciated.
Tom