0
我有登錄表單,我添加了複選框記住我,我做了我的代碼,但是當我檢查記住我複選框它記住只有用戶名only.so請任何人幫助我。記住我的登錄形式
protected void CBRemeber_CheckedChanged(object sender, EventArgs e)
{
HttpCookie MyCookie = new HttpCookie("MyCookie");
bool IsRememberme = CBRemeber.Checked;
if (IsRememberme)
{
MyCookie.Values.Add("UserName", TxtUser.Text);
MyCookie.Values.Add("Password", TXTPassword.Text);
MyCookie.Expires = DateTime.Now.AddDays(15);
}
else
{
MyCookie.Values.Add("UserName", string.Empty);
MyCookie.Values.Add("Password", string.Empty);
MyCookie.Expires = DateTime.Now.AddDays(5);
}
Response.Cookies.Add(MyCookie);
}
如何將值分配給文本框?也許這是問題所在。 – netadictos 2010-10-24 11:41:20
刪除cookie的最佳方法:http://msdn.microsoft.com/en-us/library/ms178195.aspx,myCookie.Expires = DateTime.Now.AddDays(-1d); – netadictos 2010-10-24 11:42:28
你在哪裏加密你的密碼? – Sudantha 2010-10-24 11:21:34