我有一个在LoginView中构建的超链接,文本设置为“忘记密码”。
单击超链接后,将弹出密码恢复控件(使用AJAX ModalPopUp扩展器的实现).modalpopup工作正常。但问题是,输入用户名后,在用户回答了他/她的安全答案后的第二步中,以及点击“提交”按钮时,它不会进入第3步,也没有发送电子邮件。
但是,密码在数据库中已更改(我尝试使用用户名和旧密码登录,但它无效)。
以下是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>
这是背后的代码:
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;
//Create an url that will link to a UserProfile.aspx and
//accept a query string that is the user's id
//setup the base of the url
string domainName = Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath;
//setup the second half of the url
string confirmationPage = "/Members/UserProfile.aspx?ID=" + userInfoId2.ToString();
//combine to make the final url
string url = domainName + confirmationPage;
// Replace <%VerifyUrl%> placeholder with url value
e.Message.Body = e.Message.Body.Replace("<%ResetPassword%>", url);
}
答案 0 :(得分:0)
最可能的原因可能是当您的表单在模型弹出窗口中打开时,表单(即密码恢复表单)不再保留在FORM标签内。所以你需要做类似的事情
jQuery(function() {
var dlg = jQuery("#dialog").dialog({
draggable: true,
resizable: true,
show: 'Transfer',
hide: 'Transfer',
width: 320,
autoOpen: false,
minHeight: 10,
minwidth: 10
});
dlg.parent().appendTo(jQuery("form:first"));
});
它正在移动FORM DOM内的Popup。当您的表单不在FORM DOM内时,它的数据将不会发回服务器。