HttpCookie loginCookie = new HttpCookie("name"); HttpCookie loginCookiepwd = new HttpCookie("pwd"); if (CheckBox1.Checked == true)//判断是否要保存密码 { //将用户名和密码保存到Cookie中 loginCookie.Values.Add("uname", txtUser.Text.Trim()); loginCookiepwd.Values.Add("upwd", txtPwd.Text.Trim()); Response.Cookies.Add(loginCookie); Response.Cookies.Add(loginCookiepwd); //设置用户名和密码保存的期限 loginCookiepwd.Expires = DateTime.Now.AddYears(1); loginCookie.Expires = DateTime.Now.AddYears(1); }
asp.net登录界面记住密码
最新推荐文章于 2017-03-01 09:21:20 发布