How can I reset a password for a user who forgot both the password and the answer to the password reset question? I'm using ASP.Net membership.
相关问题
- Disable SQL Membership Provider (ASP.Net Forms Aut
- Custom RoleProvider using session
- MVC 1 and IIS 7 error code 4011
- 'AllowAnonymous' could not be found
- Using ASP.NET Membership Provider with an existing
相关文章
- Disabling account lockout with the SqlMembershipPr
- Active Directory Membership Provider - how to expa
- ASP.net roles and Projects
- How should I manage membership in my ASP.NET MVC 4
- SQL Server 2005 - How often should you rebuild Ind
- How can I change the ASP.Net MVC Login Redirect ba
- ASP.NET Membership change password not working
- Password reset in Laravel 5.5 by email or mobile
In an administrative page on your site, you can simply reset a password by first getting a hold of the user:
You'll now have the automatically generated password in 'newPassword'. You could send this in an email to the user.
There are other ways to accomplish this as well. The membership database is pretty wide open, so you could come up with entry systems to get the desired new password yourself and place the hashed value in there. Please comment if you need more details. It doesn't have to be difficult.
Assuming your membership provider ("AspNetSqlMembershipProvider") in Web.config has
requiresQuestionAndAnswer="true"
, make a second provider (such as "AspNetSqlMembershipProviderAdministrativeReset") with all of the same settings except forrequiresQuestionAndAnswer="false"
.Then you can create an action that explicitly uses the second provider to allow an administrator to reset the password without requiring a correct answer to the security question, as in the following snippet: