如何使用ASP.NET成员身份检索QuestionAnswer

时间:2020-12-30 01:40:40

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.

我想知道我是否有可能从ASP.NET成员资格中获取QuestionAnswer字段的方式与获取UserName和PasswordQuestion的方式相同。

MembershipUser mu = Membership.GetUser(userId);
string username = mu.UserName;
string question = mu.PasswordQuestion;

1 个解决方案

#1


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).

我非常肯定QuestionAnswer在数据库中以与密码相同的方式进行哈希处理。如果是这种情况,那么您将无法以任何人类可读的格式获取QuestionAnswer(尽管如果您需要此格式的QuestionAnswer,您始终可以针对该表运行常规SQL查询,而不是使用成员资格API)。

If needed you can always change the password question and answer

如果需要,您可以随时更改密码问题和答案

Hope this helps.

希望这可以帮助。

#1


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).

我非常肯定QuestionAnswer在数据库中以与密码相同的方式进行哈希处理。如果是这种情况,那么您将无法以任何人类可读的格式获取QuestionAnswer(尽管如果您需要此格式的QuestionAnswer,您始终可以针对该表运行常规SQL查询,而不是使用成员资格API)。

If needed you can always change the password question and answer

如果需要,您可以随时更改密码问题和答案

Hope this helps.

希望这可以帮助。