// Enter the page for execution
// Read the saved cookie information httpcookie cookies = request. Cookies ["user_cookie"]; If (cookies! = NULL) {// If the cookie is not empty, read the username and password in the cookie and assign it to the text box at the front end. This. txt_username.text = Cookies ["username"]; // you can select the "Remember password" option here. This. usenamecheckbox. Checked = true ;}
// Run the login button
// Add cookie httpcookie cookie = new httpcookie ("user_cookie"); If (this. usenamecheckbox. checked) {// after all the authentication information is detected, if the user chooses to remember the password, the user name and password are written into the cookie and saved. Cookie. values. add ("username", this. txt_username.text.trim (); // set the cookie expiration time, which is the time of one week. After one week, the status is automatically cleared. Cookie. expires = system. datetime. Now. adddays (7.0); httpcontext. Current. response. Cookies. Add (cookie);} else {If (cookie! = NULL) {// if the user does not select to remember the password, immediately set the information in the cookie and keep the setting status expired immediately. Response. Cookies ["user_cookie"]. expires = datetime. Now ;}}