如何使用 ASP.NET 成员身份检索 QuestionAnswer
我想知道是否可以像获取 UserName 和 PasswordQuestion 一样从 ASP.NET 成员资格中获取 QuestionAnswer 字段。
MembershipUser mu = Membership.GetUser(userId);
string username = mu.UserName;
string question = mu.PasswordQuestion;
I'm wondering if it's possible for me to get the QuestionAnswer field from ASP.NET membership in the same way that you can get the UserName and PasswordQuestion.
MembershipUser mu = Membership.GetUser(userId);
string username = mu.UserName;
string question = mu.PasswordQuestion;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我非常确定 QuestionAnswer 在数据库中的哈希值与密码的哈希值相同。 如果是这种情况,那么您将无法获得任何人类可读格式的 QuestionAnswer(尽管如果您需要这种格式的 QuestionAnswer,您始终可以对表运行常规 SQL 查询,而不是使用 Membership应用程序编程接口)。
如果需要,您可以随时更改密码问题并回答
希望这有帮助。
I'm pretty certain that the QuestionAnswer is hashed in the database in the same way that the password is. If that is the case then you won't be able to get the QuestionAnswer in any sort of human-readable format (although if you require the QuestionAnswer in this format you can always run a regular SQL query against the table rather than using the Membership API).
If needed you can always change the password question and answer
Hope this helps.