Hi,
I am new to C# programming and this is my first time using AJAX.
I have a hyperlink which is build inside a LoginView and the text is set to "forgot password".
Upon clicking the hyperlink, the password recovery control will pops up (with the implementation of AJAX ModalPopUp extender).The modalpopup work well. But the problem is, after entering username and in step2 after the user had answered his/her security answer and when on hit on the "submit" button, it does not proceed to step 3 and no email was send.
However, the password was changed in the database (I tried to log in with the username and old password and it did not work).
Here is the code at passwordrecover.aspx :
<asp:HyperLink ID="HyperLink2" runat="server"
style="margin-top:15px; text-align: right;">Forget Password</asp:HyperLink>
<asp:ModalPopupExtender
ID="HyperLink2_ModalPopupExtender"
runat="server"
BackgroundCssClass="modalBackground"
DynamicServicePath=""
Enabled="True"
PopupControlID="Panel1"
TargetControlID="HyperLink2" >
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1"
runat="server"
BackColor="White"
BorderColor="Black"
BorderStyle="Solid"
BorderWidth="2px"
Height="200px"
Width="360px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"
onsendingmail="PasswordRecovery1_SendingMail">
<MailDefinition BodyFileName="~/EmailTemplates/ResetPassword.htm"
From="bedofrosesptltd@gmail.com" IsBodyHtml="True" Priority="High"
Subject="Request on the password reset for BedOfRoses's account.">
</MailDefinition>
</asp:PasswordRecovery>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="btnClose" runat="server" Text="Close" />
</asp:Panel>
Here is the code behind:
protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e)
{
System.Web.UI.WebControls.PasswordRecovery PasswordRecovery1 = (System.Web.UI.WebControls.PasswordRecovery)LoginView1.FindControl("PasswordRecovery1");
MembershipUser pwRecover = Membership.GetUser(PasswordRecovery1.UserName);
Guid userInfoId2 = (Guid)pwRecover.ProviderUserKey;
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
string confirmationPage = "/Members/UserProfile.aspx?ID=" + userInfoId2.ToString();
string url = domainName + confirmationPage;
e.Message.Body = e.Message.Body.Replace("<%ResetPassword%>", url);
}
If I remove the password recovery control from the ModalPopUp, the whole control work perfectly. Only when it is build inside the ModalPopUp, it could not proceed to the last step and no email was send. Yet the user could not logged in when his/her username and old password.