密码恢复问题

时间:2012-01-31 05:21:30

标签: asp.net sql security

构建应用程序,我在使用PasswordRecovery实用程序时遇到了一些问题。我正在使用ASP.NET内置的配置工具。我的问题是我无法使用提供的PasswordRecovery控件,因为我没有设置SMTP服务器,也不知道如何操作。

我尝试自定义控件,以便在成功恢复密码后允许我在标签内显示用户密码。到目前为止,这是我的代码:

protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
    {
        e.Cancel = true;
        MembershipUser user;
        user = Membership.GetUser(PasswordRecovery1.UserName);
        label1.Text = user.GetPassword();


    }

这是我收到的错误:

This Membership Provider has not been configured to support password retrieval.

现在我对这个错误进行了一些研究并遇到了一些奇怪的事情。 ASP.NET工具未向我的web.config文件添加任何类型的成员资格提供程序。此外,当我尝试通过配置工具测试数据库时,我得到的是:

Could not establish a connection to the database. 
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider. 

成功恢复密码后,有人可以帮助我访问用户的密码吗?如果很容易获得SMTP,我可能会尝试,但我认为在标签上显示用户密码会更容易吗?

提前致谢。

1 个答案:

答案 0 :(得分:0)

修复重置密码的错误是可行的方法。你为什么不寻求帮助?

只需设置一个SMTP服务器 - 您只需安装一个IIS附带的服务器即可。

进行密码恢复,这是糟糕的主意。你也不应该以明文形式存储密码。永远。 永远。

相关问题