有没有办法自定义 Active Directory 异常/错误消息?
我使用 Active Directory 作为网站用户的数据存储。如果密码不满足任何密码策略约束,我的 Active Directory 会抛出以下异常。
-->提供的密码无效。 密码必须与密码一致 配置的强度要求 默认提供程序。
我可以以任何方式自定义此错误消息/通知以使其更加具体吗?
我想要的是 - 如果“密码历史记录”是被违反的约束,那么错误消息应该这样说(例如新密码应该与最近 10 个使用的密码不同..)
任何帮助受到赞赏。
I am using Active Directory as a data store for the users of my website. I have Active Directory throwing the following exception in case password does not meet any password policy constraint..
-->The password supplied is invalid.
Passwords must conform to the password
strength requirements configured for
the default provider.
Can I customize this error messages/notifications in any way to be them more specific??
What I want is that - If 'password history' is the constraint that is violated then the error message should say so (ex. New password should be different than the last 10 used passwords..)
Any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以捕获它并
抛出
你自己的消息这是你想要完成的吗?
you can catch that and
throw
you own messageIs this what you are trying to accomplish?
那么您应该看到抛出的异常的确切类型,并为此异常设置特定的catch。
如果您看到此链接,http://msdn.microsoft.com/en-us /library/0yd65esw.aspx,您将看到可以捕获多个特定的异常。
然后您可以将您想要的任何消息返回给用户。
Well you should see the exact type of Exception that is thrown, and setup a specific catch for this exception.
If you see this link, http://msdn.microsoft.com/en-us/library/0yd65esw.aspx, you will see that you can catch multiple specific Exceptions.
You could then return whatever msg you want to the user.