无需提供者的 ChangePassword 控制
有没有办法让 ChangePassword 控件在没有会员提供商的情况下工作?就像登录控件通过身份验证事件工作一样,我是否可以使该组件使用我的密码更改功能,然后显示成功视图,而无需我编写自定义提供程序?
谢谢, 尤金.
编辑:
只是为了澄清,经过 Reflector 的一些研究后,我得出的结论是,如果没有 MembershipProvider,这个控件是完全没有用的。每个逻辑位(例如读取配置文件和验证用户输入)都外包给提供商,因此您也必须编写此通用代码。
这是足以使该控件工作的函数列表:
public bool ChangePassword(string username, string oldPassword, string newPassword)
public MembershipUser GetUser(string username, bool userIsOnline)
public int MinRequiredNonAlphanumericCharacters { get; }
public int MinRequiredPasswordLength { get; }
最后两个仅在从 ChangePassword
函数返回 false 时用于错误消息。
Is there a way to make ChangePassword control work without Membership provider? Like the same way Login control works through an Authenticate event, could I make this component to use my password changing function and then showing success view without me writing custom provider?
Thanks,
Eugene.
EDIT:
Just to clarify after some research through Reflector I came to conclusion that this control is totally useless without MembershipProvider. Every logic bit, like reading configuration file and validating user inputs is outsourced to providers, so you have to write this generic code as well.
This is the list of functions sufficient to make this control work:
public bool ChangePassword(string username, string oldPassword, string newPassword)
public MembershipUser GetUser(string username, bool userIsOnline)
public int MinRequiredNonAlphanumericCharacters { get; }
public int MinRequiredPasswordLength { get; }
The last two are only used for error message if you return false from ChangePassword
function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过反射器查看 .NET 3.5 源代码,当受保护的 OnBubbleEvent 检测到 ChangePassword 按钮事件时,它会调用 AttemptChangePassword()。该方法的实现大致如下所示:
看起来您可以:
所以看起来这在某种程度上是可能的,但该控件在设计时绝对没有考虑到这种用途——它很好地硬连接到了 MembershipProvider。
Looking at the .NET 3.5 source through reflector, when the ChangePassword button event gets detected by protected OnBubbleEvent, it calls AttemptChangePassword(). The implementation of that method looks roughly like this:
It looks like you could:
So it looks like it's somewhat possible, but the control definitely wasn't designed with this use in mind -- it's pretty well hard-wired to MembershipProvider.