0

I'm implementing a password recovery page on a site I'm developing using a sample. I set up the page so it emails the user with the new password, which is great. The password is hashed so I can not see what is in the database of course.

Well, the new password doesn't work. Haha. Been working on this one issue for over two hours and need to move onto another aspect of the project. Has anyone else had this issue?

<%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RecoverPassword.aspx.cs" Inherits="RecoverPassword" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <h2>Recover Your Password</h2>
    <p>
        <asp:PasswordRecovery ID="RecoverPwd" runat="server" 
            onsendingmail="RecoverPwd_SendingMail">
            <MailDefinition BodyFileName="~/EmailTemplates/PasswordRecovery.txt" 
                Subject="Your password has been reset...">
            </MailDefinition>
        </asp:PasswordRecovery>
    </p>
</asp:Content>

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class RecoverPassword : System.Web.UI.Page
{
    protected void RecoverPwd_SendingMail(object sender, MailMessageEventArgs e)
    {
        e.Message.CC.Add("dwayne.jarman@fda.hhs.gov");
    }
}

<membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider" 
         type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXX" 
         connectionStringName="DefaultConnection" 
         enablePasswordRetrieval="false" 
         enablePasswordReset="true" 
         requiresQuestionAndAnswer="false" 
         requiresUniqueEmail="true" 
         maxInvalidPasswordAttempts="5" 
         minRequiredPasswordLength="6" 
         minRequiredNonalphanumericCharacters="0" 
         passwordAttemptWindow="10" 
         applicationName="/"/>
  </providers>
</membership>
4

2 回答 2

0

确保数据库中的格式是散列的 (1),您可以在 aspnet_Membership 和“PasswrodFormat”中找到它。

还可以尝试在您的会员设置中包含此属性,passwordFormat="Hashed"。

于 2013-06-24T02:39:55.123 回答
0

可能是 ApplicationName 与用于创建用户的名称不同。查看 aspnet_Users 和 aspnet_Application 表进行检查。

于 2013-06-24T01:39:36.123 回答