记住我在asp.net中的密码 [英] Remember me password in asp.net
本文介绍了记住我在asp.net中的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
记住我的密码,任何人都可以知道,请帮助我
hi
Remember me password can any body know please help me
推荐答案
^ ]简单的教程可能会有所帮助.
This[^] simple tutorial may help.
您可以使用cookie来做到这一点,有很多替代解决方案,请随时与我们联系以寻求进一步的帮助.
You can do this by using cookie, there are so many alternate solutions, please feel free to contact for further help.
protected void btnLogin_Click(object sender, EventArgs e)
{
try
{
HttpCookie myCookie = new HttpCookie("myCookie");
Response.Cookies.Remove("mycookie");
Response.Cookies.Add(myCookie);
myCookie.Values.Add("UserName", txtUserName.Text.ToString());
myCookie.Values.Add("Password", txtPassword.Text.ToString());
DateTime dtxpiry = DateTime.Now.AddDays(15);
if (chkRememberPassword.Checked == true)
{
if (Request.Cookies["myCookie"] != null)
{
HttpCookie getCookie = Request.Cookies.Get("myCookie");
string userName = getCookie.Values["UserName"].ToString();
string password = getCookie.Values["Password"].ToString();
}
}
for storing and using cookie and if page is valid
if (Page.IsValid)
{
if (validateuser != null)
{
Response.Redirect("abc.aspx");
}
else
{
lblErrorMessage.Visible = true;
lblErrorMessage.Text = "InvalidUser";
}
Cookie ''Remember me'' Login Script
Want to know more about cookie?
您可以轻松地对其进行Google搜索- ^ ]
You could have easily Googled it - remember me option in asp.net[^]
这篇关于记住我在asp.net中的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文