Resets a user's password to a new, automatically generated password.

Namespace: Novalys.VisualGuard.Security.Membership
Assembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2016.0.105.16 (2016.0.105.16)

Syntax

C#
public string ResetPassword(
	string passwordAnswer
)
Visual Basic
Public Function ResetPassword ( 
	passwordAnswer As String
) As String

Parameters

passwordAnswer
Type: System..::..String
The password answer for the membership user.

Return Value

Type: String
The new password for the membership user.

Remarks

The password answer check is case sensitive. We strongly recommend to store the password answer as a lowered string and provide a lowered value of the password answer when you want to reset the password by using the password question and answer.

C# Copy imageCopy
<para>
            user.ChangePasswordQuestionAndAnswer(myPassword.Text, newPasswordQuestion.Text, newPasswordAnswer.Text.ToLowerInvariant())
            </para><para>
            user.ResetPassword(myPasswordAnswer.Text.ToLowerInvariant())
            </para>
Visual Basic Copy imageCopy
<para>
            user.ChangePasswordQuestionAndAnswer(myPassword.Text, newPasswordQuestion.Text, newPasswordAnswer.Text.ToLowerInvariant())
            </para><para>
            user.ResetPassword(myPasswordAnswer.Text.ToLowerInvariant())
            </para>

Exceptions

ExceptionCondition
System..::..NotSupportedExceptionEnablePasswordReset is not set to true.

- or -

The user is not a Visual Guard account.
System..::..ArgumentNullExceptionRequiresQuestionAndAnswer is set to true and the passwordAnswer is null.
Novalys.VisualGuard.Security.Membership..::..VGMembershipPasswordExceptionpasswordAnswer is invalid.

- or -

The user account is currently locked out or does not exist.

- or -

The generated password does not pass the password policy validation.

See Also