MembershipUser::ChangePasswordQuestionAndAnswer Method (String^, String^, String^)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Updates the password question and answer for the membership user in the membership data store.

Namespace:   System.Web.Security
Assembly:  System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)

public:
virtual bool ChangePasswordQuestionAndAnswer(
	String^ password,
	String^ newPasswordQuestion,
	String^ newPasswordAnswer
)

Parameters

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: System::Boolean

true if the update was successful; otherwise, false.

Exception Condition
System::ArgumentException

password is an empty string.

-or-

newPasswordQuestion is an empty string.

-or-

newPasswordAnswer is an empty string.

System::ArgumentNullException

password is null.

PlatformNotSupportedException

This method is not available. This can occur if the application targets the .NET Framework 4 Client Profile. To prevent this exception, override the method, or change the application to target the full version of the .NET Framework.

ChangePasswordQuestionAndAnswer calls the ChangePasswordQuestionAndAnswer method of the membership provider referenced by the ProviderName property to update the password question and answer for the membership user in the membership data store.

The membership provider may have restrictions on the size of the password question and answer. For size limitations, see the documentation for the membership provider.

The following code example updates the password question and answer for the current logged-on user.

System_CAPS_security Security Note

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: