Easy Tutorial
❮ Prop Webcontrol Standard Cssclass Control Htmltablecell ❯

WebSecurity - GeneratePasswordResetToken()



Definition

The GeneratePasswordResetToken() method generates a password reset token, which can be sent to the user via email to allow the user to reset their password.


C# and VB Syntax


Parameters

Parameter Type Description
userName String The username
expiration Integer Token expiration time in minutes. Default is 1440 (24 hours)

Return Value

Type Description
String A reset token.

Errors and Exceptions

In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:


Remarks

If the user has forgotten their password, use the ResetPassword() method. The ResetPassword() method requires a password reset token.

Confirmation tokens can be created via 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 the user can confirm the new password with a new token:


Technical Data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll
❮ Prop Webcontrol Standard Cssclass Control Htmltablecell ❯