如何在 Asp.Net 中不设置问题和答案的情况下创建用户?
我对 Asp.Net 有一个相当独特的情况。 管理员用户必须为网站创建任何新用户。 由于其他人正在创建新用户,因此让他们创建安全问题和答案来恢复新用户的密码是没有意义的。
但是,我想使用安全问题和答案来允许用户重置密码。 所以我的会员资格提供商有 requireQuestionAndAnswer="true" 。
问题是,因为我将 requireQuestionAndAnswer 设置为 true,所以如果不提供问题和答案,我无法创建新用户。 创建新用户时有没有办法绕过这个要求?
I have a fairly unique situation with Asp.Net. An admin user must create any new user for the web site. Since somebody else is creating the new user, it doesn't make sense to have them create a security question and answer to recover the password for the new user.
However, I want to use the security question and answer in order to allow a user to reset their password. So I have requiresQuestionAndAnswer="true" for my membership provider.
The problem is that because I have requiresQuestionAndAnswer set to true, I'm unable to create a new user without supplying a question and answer. Is there a way to get around this requirement when creating a new user?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了类似的问题。 我最终加载了一个虚拟问题..“天空是什么颜色?”。
I ran into a similar issue. I ended up loading a dummy question.. "What color is the sky?".
尝试输入默认问题,以便用户在获得访问权限后可以立即更改密码。
当然,这意味着他们最好不要忘记……
Try putting in a default question so the users can immediately change their password once they get access.
Of course, this means they had better not forget it...