Export (0) Print
Expand All

MembershipUser.ChangePasswordQuestionAndAnswer Method

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)

abstract ChangePasswordQuestionAndAnswer : 
        password:string * 
        newPasswordQuestion:string * 
        newPasswordAnswer:string -> bool  
override ChangePasswordQuestionAndAnswer : 
        password:string * 
        newPasswordQuestion:string * 
        newPasswordAnswer:string -> bool

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.

ExceptionCondition
System.ArgumentException

password is an empty string.

-or-

newPasswordQuestion is an empty string.

-or-

newPasswordAnswer is an empty string.

System.ArgumentNullException

password is a null reference (Nothing in Visual Basic).

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 noteSecurity 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

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft