WebSecurity - ResetPassword()
Definition
The ResetPassword() method resets the user's password using a password token.
C# and VB Syntax
Parameters
Parameter | Type | Description |
---|---|---|
passwordResetToken | String | The password token |
newPassword | String | The new password |
Return Value
Type | Description |
---|---|
Boolean | Returns true if the password has been changed, otherwise false. |
Errors and Exceptions
Under the following conditions, any access to the WebSecurity object will throw an InvalidOperationException:
The InitializeDatabaseConnection() method has not been called
SimpleMembership is not initialized (or disabled in the site configuration)
Remarks
Use the ResetPassword method if the user has forgotten their password.
The ResetPassword method requires a password reset token.
The token can be confirmed through the CreateAccount(), CreateUserAndAccount(), or GeneratePasswordResetToken() methods.
Passwords can be reset via code, but the general process is to send an email to the user (with the token and a link to a page) so that the user can confirm the new password with a new token:
Technical Data
Name | Value |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |