更改 PasswordRecovery 控件中锁定用户的错误消息
我将 ASP.NET PasswordRecovery 控件与标准成员资格提供程序结合使用。被锁定的用户收到令人困惑的错误消息
我们无法访问您的信息。请重试。
我想更改此消息,但没有办法。属性 XXXFailureText 特别是 GeneralFailureText 包含多个字符串。似乎有一个隐藏文本用于这种特殊类型的错误,我无法使用属性进行更改。
I use the ASP.NET PasswordRecovery control in combination with the standard membership provider. A locked out user gets the confusing error message
We were unable to access your information. Please try again.
I want to change this message, but find no way. The properties XXXFailureText especially GeneralFailureText contain over strings. There seems to be a hidden text used for this special kind of error I can't change using a property.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这也让我很头疼,直到我尝试了这个。我向VerifyingUser 事件添加了代码,以在用户被锁定时设置UserNameFaileurText,并且效果很好,即错误消息正是我想要的。
This was causing me a headache too, until I tried this. I added code to the VerifyingUser event to set the UserNameFaileurText if the user was locked out and it worked great, that is the error message was exactly what I wanted it to be.
您是否使用自定义会员资格提供商?此错误可能是由部分实现的会员资格提供程序引起的。
您还需要检查 web.config 设置。确保设置了类似的内容:
并检查您的邮件设置/smtp 部分是否正确设置了“发件人”电子邮件地址。
或者在
PasswordRecovery
中设置“from”顺便说一句,您指定的错误消息是默认的
UserNameFailureText
。 http://msdn.microsoft.com /en-us/library/system.web.ui.webcontrols.passwordrecovery.usernamefailuretext.aspx如果所有其他方法都失败,您可以劫持事件并取消它们,然后显示你自己的错误消息。特别是
UserLookupError
和其他 *Error 事件。 http://msdn.microsoft.com/en -us/library/system.web.ui.webcontrols.passwordrecovery_events.aspxAre you using a custom membership provider? This error can be cause by a partially implemented membership provider.
You also need to check you web.config settings. make sure that something like this is set:
As well as check they your mailsettings/smtp section is setup properly with a 'from' email address.
or set the 'from' in
PasswordRecovery
btw, your specified error message is the default
UserNameFailureText
. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.passwordrecovery.usernamefailuretext.aspxIf all else fails, you could hijack the events and cancel them, then show your own error message. Specially the
UserLookupError
and the other *Error events. http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.passwordrecovery_events.aspx在控件的属性窗口中,有一个用于显示文本的字段,您可以更改该文本
In the properties window of the control there is a field for the text displayed that you can change