如何设置新密码 [英] how to set new password

查看:106
本文介绍了如何设置新密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过输入安全性问题和答案来设置新密码

how to set new password bye entering security question and answer

推荐答案

Membership.GetUser().PasswordQuestion包含安全性问题.

Membership.GetUser().ResetPassword(securityQuestionAnswer)将为用户生成一个新的随机密码.然后您可以通过电子邮件将其发送给用户.

http://msdn.microsoft.com/en-us/library/d90zte4w.aspx [ ^ ]

如果需要密码回答,并且提供了错误的密码回答,则成员资格提供者将引发MembershipPasswordException.如果要允许用户输入密码,可以检查以确保不会引发此异常,然后更改密码.

有关更多信息,请参见以下线程:
更改密码功能! [
Membership.GetUser().PasswordQuestion contains the Security Question.

Membership.GetUser().ResetPassword(securityQuestionAnswer) will generate a new random password for the user. You can then email this to the user.

http://msdn.microsoft.com/en-us/library/d90zte4w.aspx[^]

If a password answer is required and an incorrect password answer is supplied, a MembershipPasswordException is thrown by the membership provider. If you wanted to allow the user to enter a password, you could check to ensure that this exception is not thrown, then change the password.

For more have a look on following thread:
Change Password Function![^]


这篇关于如何设置新密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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