MembershipUser::ChangePasswordQuestionAndAnswer Method
Updates the password question and answer for the membership user in the membership data store.
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.
| 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 nullptr. |
| 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.
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. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Security Note