views:

404

answers:

1

Hi (I'm pretty new to this),

I have created a portal where the user logs in and within that, they can view other programs I've made. The problem is the password recovery does not seem to be working - I get no error messages, I just get the message "We were unable to access your information. Please try again." I have the ASP.NET configuration setup correctly and have tested this with different users and permissions but I was just wondering if there is something I need to do in the configuartion manager or the web.config so that this can work.

Below is the code for the password recovery tool:

<form id="form1" runat="server">
<div align="center">
    <asp:PasswordRecovery ID="PasswordRecovery1" runat="server" Height="147px" Width="442px" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em">
        <UserNameTemplate>
            <table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse">
                <tr>
                    <td style="width: 445px">
                        <table border="0" cellpadding="0" style="width: 442px; height: 147px">
                            <tr>
                                <td align="center" colspan="2">
                                    <strong><span style="font-size: 0.9em">Password Recovery</span></strong></td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2">
                                    &nbsp;</td>
                            </tr>
                            <tr>
                                <td align="right">
                                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Username:</asp:Label></td>
                                <td style="width: 291px">
                                    <asp:TextBox ID="UserName" runat="server" Width="187px"></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                                        ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="PasswordRecovery1">*</asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" colspan="2" style="color: red">
                                    <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2" style="text-align: right">
                                    <asp:Button ID="SubmitButton" runat="server" CommandName="Submit" Text="Submit" ValidationGroup="PasswordRecovery1"
                                        Width="103px" />
                                    &nbsp; &nbsp;
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </UserNameTemplate>
        <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
        <SuccessTextStyle Font-Bold="True" ForeColor="#5D7B9D" />
        <TextBoxStyle Font-Size="0.8em" />
        <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
        <SubmitButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
            BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
    </asp:PasswordRecovery>
</div>
</form>

Thank you.

+1  A: 

Looks right to me. Check your webconfig to make sure your membership provider has

  • enablePasswordRetrieval="false"
  • enablePasswordReset="true"
  • requiresQuestionAndAnswer="false"

Also you need to set up a mail definition in your web.config for the control to be able to mail the new password.

<mailSettings>
  <smtp from="[email protected]">
    <network host="your.smtp.server" port="25"/>
  </smtp>
</mailSettings>
Oscar Kilhed
Thank you, it works great now :)
Mike