如何在成员资格提供程序中自定义Default-UserPassword格式 [英] How Customize Default-UserPassword Formate in Membership-Provider

查看:82
本文介绍了如何在成员资格提供程序中自定义Default-UserPassword格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Membership.CreateUser(txtUsrId.Text,txtPwd.Text,txtUsrEMail.Text,"demo","demo",true,out createStatus)
-------------------------------------------------- ----------
在上面的代码中,它将仅接受具有特殊字符的密码.
我如何自定义此方法,以便用户可以输入任何内容作为密码

Membership.CreateUser(txtUsrId.Text, txtPwd.Text, txtUsrEMail.Text, "demo", "demo", true, out createStatus)
------------------------------------------------------------
In the above code it will accept the password with special-charectors only.
How can I customize this so that user can enter anything as password

推荐答案

如果没有其他方法,最后一种解决方法是,Asp.Net提供程序是可自定义的,我们可以扩展提供程序(MemberShipProvider)并覆盖所需的方法,并让其他方法调用其基本功能.在这种情况下,您需要覆盖MemberShipProvider的CreateUser,并将用户插入数据库,并具有自己的密码逻辑,则可能还必须考虑覆盖ChangePassword.不要忘记在web.config提供商部分中配置新的提供商.
if there is no other way, one last solution is , Asp.Net providers are customizable, we can extend the providers (MemberShipProvider) and override the required methods and let the other methods call their base functionality. In your case you need to override CreateUser of MemberShipProvider, and have you insert the user into database, and have your own logic for passwords, you may have to consider overriding ChangePassword also. Don''t forget to configure the new provider in web.config providers section.


这篇关于如何在成员资格提供程序中自定义Default-UserPassword格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆