Hey... I Remember You! - The "remember me" part
(Page 6 of 7 )
We can now create new user accounts and they can login. They can also choose to be remembered by checking the “Remember Me” box, which sets two cookies: u (username) and p (password).
To complete our project, we will have to make a couple of modifications to the login.asp script. The code below will automatically fill out the login form with the cookies of the users username and password. If there is no cookie, the username and password fields will take the default value of “” (empty). The “Remember Me” checkbox will also be selected:
26. Username: <input type="text" name="uname" maxlength="20" value="<%=Request.Cookies("u")%>">
27. Password: <input type="password" name="pass" maxlength="20" value="<%=Request.Cookies("p")%>">
28. <input type="checkbox" name="remember" value="ON" checked> Remember MeTo test our application, fire up the adduser.asp page in your browser and create a new user with username “test” and password “go”. Jump to login.asp, enter the username “test” and password “go” and make sure the “Remember Me” checkbox is selected. Click the “Login Now” button.
Next, close the web browser. Re-Open it and goto login.asp. Notice your username and password fields are automatically filled in! To get rid of them, click on the “Login Now” button with the “Remember Me” checkbox not selected.

Next: Conclusion >>
More ASP Articles
More By Mitchell Harper