Search code examples
.netmembershipreset-password

.NET Membership - Register, login etc. works. Password reset doesn't


I'm trying to allow for reset password functionality to my site without utilizing question/answer functionality (this is deactivated in the membership entry in web.config).

However when calling resetPassword (using the automatically generated controller/service/provider from the .NET MVC framework) an error is thrown (Input string was not in a correct format).

Function ResetPassword(ByVal userName As String, ByVal answer As String) As Boolean Implements IMembershipService.ResetPassword
    Return _provider.ResetPassword(userName, "answer") //Membership.Provider (default one)
End Function

It doesn't matter if I pass Nothing or "answer" (as shown) hardcoded into the process (both registration and above), the error is still thrown and the password isn't reset.

Any thoughts??


Solution

  • If you don't want to use that functionality at all, then you can set the answer to the same string when creating all your users - then use the same string again for your ResetPassword(..) call and all will work as intended.

    Not ideal in terms of security, but it does work. (I've done it on a few sites where I didn't want to use that [annoying] feature).