Updates the password question and answer for the membership user in the Visual Guard repository

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 static bool ChangePasswordQuestionAndAnswer(
	string username,
	string password,
	string newPasswordQuestion,
	string newPasswordAnswer
)
Visual Basic
Public Shared Function ChangePasswordQuestionAndAnswer ( 
	username As String,
	password As String,
	newPasswordQuestion As String,
	newPasswordAnswer As String
) As Boolean

Parameters

username
Type: System..::..String
The user to update the password question and answer for.
password
Type: System..::..String
The current password for the membership user.
newPasswordQuestion
Type: System..::..String
The new password question value for the membership user.
newPasswordAnswer
Type: System..::..String
The new password answer value for the membership user.

Return Value

Type: Boolean
true if the update was successful; otherwise, false.

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
user.ChangePasswordQuestionAndAnswer(myPassword.Text, newPasswordQuestion.Text, newPasswordAnswer.Text.ToLowerInvariant())

C# Copy imageCopy
user.ResetPassword(myPasswordAnswer.Text.ToLowerInvariant())

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionpassword is null

or

newPasswordQuestion is null and the RequiresQuestionAndAnswer is set to true.

or

newPasswordAnswer is null and newPasswordQuestion is not null or empty.

or

username is null.
System..::..ArgumentExceptionusername is empty or is longer than 64 characters or contains invalid chars ('\', '/', '?', '*', '%', ';', ''', '"', ':', '|', '[', ']', '+', '=', ',').

or

password or newPasswordAnswer is longer than 64 characters.

or

newPasswordQuestion is empty or longer than 256 characters

or

newPasswordQuestion is empty or null and the repository property "Requires Question And Answer" is set to true.

System.Security..::..SecurityExceptionThe current user has not enough privileges to use Membership API. The Membership access level of the application must be sufficient to allows this action or the 'Membership Manager' role must be granted to the user by using the Visual Guard console.

See Also