ASP.NET通过回答提示问题以邮件方式找回密码

首先要配置web.config

1. 确保enablePasswordRetrieval="true"  requiresQuestionAndAnswer="true" passwordFormat="Encrypted"

2. 在<system.web>内加入machineKey的配置,用于加密,在线生成machineKey的网站 http://aspnetresources.com/tools/machineKey

3. 在<system.net> 中配置<mailSettings>用于发送邮件给找回密码的客户,发送到他注册的邮箱。

4. 编写RetrievePassword.aspx页面用于找回密码,下面是RetrievePassword.aspx页面代码

RetrievePassword.aspx

下面是RetrievePassword.aspx.cs 代码

RetrievePassword.aspx

功能页面展示:

mx3213

用户名和提示问题是绑定到textbox的,只读显示,用户只是要输入答案:

mx3215

image

打开163邮箱,收到了,耶!

image

 


 


 


原文地址:https://www.cnblogs.com/seapub/p/2391458.html