ASP.NET MVC Forms Authentication Remember Me
I have an ASP.NET MVC2 application, and I'm using FormsAuthentication to manage the Auth Cookie. When the cookie expires and the page is access, I need to display the Username in the field and the Reme开发者_JAVA百科mber Me checked. How can I do this once the cookie expired and I don't have access to it?
You don't by default. Cookie expired means the client is a full new user to the system.
Possible solution: You might want to set a cookie with an expiration date in 2099 or something, and store the username in there after logging in. When a 'blank' user hits your authentication page, you can check whether the cookie exists, and prefill the username and the remember me checkbox.
精彩评论