Visual Guard Class Library Documentation

VGSecurityManager.ResetPassword Method (String, String)

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

public static string ResetPassword(
   String name,
   String passwordAnswer
);

Parameters

name
The name of the user to reset the password for.
passwordAnswer
The password answer for the specified user.

Return Value

The new password for the specified 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.

user.ChangePasswordQuestionAndAnswer(myPassword.Text, newPasswordQuestion.Text, newPasswordAnswer.Text.ToLowerInvariant())

user.ResetPassword(myPasswordAnswer.Text.ToLowerInvariant())

Exceptions

Exception TypeCondition
ArgumentNullException

The name is null.

or

The passwordAnswer is null and RequiresQuestionAndAnswer is set to true.

ArgumentException

The name or passwordAnswer is longer than 64 characters

or

The name is empty.

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.
NotSupportedException

EnablePasswordReset is not set to true.

- Or -

the repository does not support Visual Guard authentication mode.

See Also

VGSecurityManager Class | Novalys.VisualGuard.Security Namespace | VGSecurityManager.ResetPassword Overload List