Exceptions from ResetPassword

Jun 12, 2010 at 9:38 PM

Currently, the XmlMembershipProvider throws an exception in a couple of different cases, one of them being if the answer to the security question is incorrect when attempting to reset the password of a user. This isn't necessarily wrong, as any code that calls the ResetPassword function could catch these exceptions. However, if using the built in ASP.NET control PasswordRecovery, there's no customizable code to the back-end of this control, and it doesn't handle exceptions if the security question is incorrect.

I assumed that the PasswordRecovery control would display a message if the answer was wrong instead of throwing an exception. I tried changing the exceptions in the ResetPassword to instead just return null, and that got the PasswordRecovery control working the way I wanted it to. I don't know if the provider's code should be changed that way or not, as I'm not sure what the correct behavior for ResetPassword should be, but it worked well for me as a quick fix.