ASP 密码恢复不起作用
我的页面上有一个 ASP 密码恢复模块,代码如下所示:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
<MailDefinition From="[email]">
</MailDefinition>
</asp:PasswordRecovery>
但是,当我提交表单时,我只是收到消息,“我们无法访问您的信息。请重试。” >
我看到这个问题并确保将这些属性添加到我的web.config 此处:
<providers>
<remove name="CustomizedMembershipProvider"/>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MessageBank"
applicationName="MessageBank"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
enablePasswordReset="true"
enablePasswordRetrieval="false" />
</providers>
电子邮件工作正常,因为该应用程序全天定期发送电子邮件。但由于某种原因,它没有发送恢复电子邮件。
这是相关的 web.config 部分:
<mailSettings>
<smtp from="[email]">
<network host="[host]" password="[password]" userName="[username]"/>
</smtp>
</mailSettings>
更新:我添加了一个函数来处理“SendingMail”事件:
Protected Sub PasswordRecovery_submit(ByVal sender As Object, ByVal e As WebControls.MailMessageEventArgs) Handles PasswordRecovery.SendingMail
我在此函数中添加了一个断点,但它从未到达,上面的错误消息只是出现在应用程序中。还有其他方法可以调试出现的问题吗?
I have an ASP PasswordRecovery module on a page, the code comes up like this:
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
<MailDefinition From="[email]">
</MailDefinition>
</asp:PasswordRecovery>
However, when I submit the form I just get the message, "We were unable to access your information. Please try again."
I saw this question and made sure to add those attributes to my web.config here:
<providers>
<remove name="CustomizedMembershipProvider"/>
<add name="CustomizedMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="MessageBank"
applicationName="MessageBank"
minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
enablePasswordReset="true"
enablePasswordRetrieval="false" />
</providers>
The email is working fine because the app sends emails regularly throughout the day. But it's not sending recovery emails for some reason.
Here's the relevant web.config section:
<mailSettings>
<smtp from="[email]">
<network host="[host]" password="[password]" userName="[username]"/>
</smtp>
</mailSettings>
UPDATE: I added a function to handle the "SendingMail" event:
Protected Sub PasswordRecovery_submit(ByVal sender As Object, ByVal e As WebControls.MailMessageEventArgs) Handles PasswordRecovery.SendingMail
I added a break point in this function but it is never reached, the above error message just comes up in the app. Any other ways to debug what's going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否记得在 web.config 中声明您的 smtp 部分?默认情况下,密码恢复控件在执行期间使用它。
Have you remembered to declare your smtp section in your web.config? By default the password recovery control uses this during it's execution.
该错误消息是默认的
UserNameFailureText
您确定输入的用户名有效吗?
That error message is the default
UserNameFailureText
Are you sure you are entering a valid user name?
这是我解决问题的方法。正如 Brian 的答案的评论中提到的,我们的应用程序正在使用自定义电子邮件功能(不能 100% 确定原因,但常规 SMTP 功能不起作用)。无论如何,您可以简单地劫持
PasswordRecovery.SendingMail
事件:Here is how I solved the problem. As mentioned in the comments on Brian's answer, our app is using a custom email function (not 100% sure why but the regular SMTP stuff just doesn't work). Anyway, you can simply hijack the
PasswordRecovery.SendingMail
event: