ResetPassword Method
Syntax
Arguments
- UserNameCharacter
The name of the user.
- PasswordAnswerCharacter
The value must match the password answer set for the user when the selected membership provider requires a password answer for password reset. The match is case-insensitive for SqlServerMembership provider. This is the provider used when the publish profile uses "SqlServer" for the Membership provider.
Returns
- resultCharacter
Returns the newly generated password.
Description
Reset the user's password to a generated password.
Discussion
Context.Security.ResetPassword() reset the user's password to a generated password. If a password answer is required, PasswordAnswer must be supplied. The return value is the newly generated password. Check Context.Security.CallResult.Success before using the return value.
dim user as c = "[email protected]" dim newPassword as c = context.security.resetPassword(user) if .not. Context.Security.CallResult.Success then '' Error generating new password error_generate(Context.Security.CallResult.Text) end if
You must set Lost password action to "Reset Password" in the Security Settings to use the ResetPassword() method. If the Lost password action is set to "Not Allowed", ResetPassword() will fail.