自定义会员资格提供程序和 ChangePassword 控件
我在以下链接的帮助下为现有数据库架构实现了自定义 Membership
提供程序
我已重写以下方法 CreateUSer
、ValidateUser
、 GetUser
、ChangePassword
和 ResetPassword
。 对于 ChangePassword
方法,它会验证新密码的最小长度以及字母数字字符数。如果验证失败,该方法将抛出一个带有确切错误的参数异常。
我面临的问题是,我使用内置的更改密码控件,出现以下错误, "Argumnet exception was unhandled in user code"
。
它还显示一个一般错误,
"Password incorrect or New Password invalid."
我宁愿显示密码验证失败的错误的确切原因。
我该如何实施这个。我将不胜感激任何帮助或指导。
谢谢
I have implemented a Custom Membership
provider for my existing database schema with the help of the following link
I have overridden the following methods CreateUSer
, ValidateUser
, GetUser
, ChangePassword
and ResetPassword
.
For the ChangePassword
method , it validates the new password for the Minimum length and also for the Number of Alphanumeric characters. If the validation fails the method throws an Argument Exception with the exact error.
The problem what I face is, I am using the built in Change password control, I get the following error, "Argumnet exception was unhandled in user code"
.
Also it displays a generic error
"Password incorrect or New Password invalid."
I would rather want to display the exact reason of the error why the password validation failed.
How do i go abou implementhing this. I would appreciate any help or guidance.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题出在您的实现中 虚拟函数
MembershipUser.ChangePassword
来自MSDN 文章中,它需要采用 2 个参数:如果没有看到您的 ChangePassword 函数,我猜您
编辑:根据您的评论,您真正想做的是处理ChangePasswordError 事件。这将让您在出现错误时提供自定义反馈。
The problem is likley in your implementation the virtual function
MembershipUser.ChangePassword
From the MSDN article, it needs to take 2 parameters:Without seeing you ChangePassword function, I would guess that you are
Edit: Based on your comment, what you really want to do is handle the ChangePasswordError event of the ChangePassword control. This will let you provide custom feedback when an error is raised.
我也有同样的问题。看来您必须使用常规表单并创建错误处理来显示您想要的消息,而不是显示的内置消息。
I'm having the same issue. It appears you'll have to use a regular form and create error handling to display the message you would like instead of the built in message that appears.