忘记asp.net中的密码 [英] forget password in asp.net

查看:83
本文介绍了忘记asp.net中的密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能给我一些有关忘记密码的想法..

我有一个页面,并进行了自定义用户管理..

现在我希望有人忘记密码

我给了他一个文本框来写他的电子邮件,当他单击忘记密码"按钮时,新密码将保存到他的数据库中,并且会通过他的电子邮件地址向他发送一封电子邮件,并且密码已保存到他的数据库中. />
如果有人知道更好的方法来做到这一点.然后请告诉我..
谢谢..

can anyone give me some idea about forget password issue..

i have a page and i made a custome user management..

and now i want that if some one forget a password

i gave him a textbox to write his email and as soon as he click on a forget password button the new password is saved to his database and an email is send to him on his email address having the same password saved to his database.

if some one know some better way to do this. then pls tell me..
thanks..

推荐答案

否-那是最好的方法.它允许您将他的密码保留为哈希,这意味着无法读取或还原该密码,并让用户获得一个新密码.您还应该为用户提供一些更改密码的机制,并让新"密码难以输入以鼓励他更改密码!

我个人使用Guid.NewGuid().ToString()生成新密码,但也有 ^ ]
no - that is the best way. It allows you to keep him password as a hash, which means that it can''t be read or restored, and lets the user get a new one. You should also provide some mechanism for the user to change his password, and also make the "new" password difficult to enter to encourage him to change it!

Personally, I use Guid.NewGuid().ToString() to generate the new password, but there is also the Membership.GeneratePassword method[^]


尝试以下操作:
恢复和更改密码

SqlMembershipProvider.GetPassword方法
Try the following:
Recovering and Changing Passwords

SqlMembershipProvider.GetPassword Method


试试这个

Try this

public static string GetPasswordHash(string password)
        {
            byte[] _bytePassword = ASCIIEncoding.ASCII.GetBytes(password.Trim());
            _bytePassword = new SHA1CryptoServiceProvider().ComputeHash(_bytePassword);

            //do convert it to string for display & storing in DB
            int i;
            StringBuilder sbOutput = new StringBuilder(_bytePassword.Length);
            for (i = 0; i < _bytePassword.Length - 1; i++)
            {
                //build string array from byte array
                sbOutput.Append(_bytePassword[i].ToString("X2"));//"X2" is used to convert byte array to string
            }
            return sbOutput.ToString();
        }


这篇关于忘记asp.net中的密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆