MembershipUser::ChangePassword Method (String^, String^)
Updates the password for the membership user in the membership data store.
Assembly: System.Web.ApplicationServices (in System.Web.ApplicationServices.dll)
Parameters
- oldPassword
-
Type:
System::String^
The current password for the membership user.
- newPassword
-
Type:
System::String^
The new password for the membership user.
| Exception | Condition |
|---|---|
| System::ArgumentException | oldPassword is an empty string. -or- newPassword is an empty string. |
| System::ArgumentNullException | oldPassword is null. -or- newPassword 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. |
ChangePassword calls the ChangePassword method of the membership provider referenced by the ProviderName property to update the password for the membership user in the membership data store.
The membership provider may have restrictions on the size of the password. For size limitations, see the documentation for the membership provider.
The following code example modifies the password 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. |
Available since 2.0
.jpeg?cs-save-lang=1&cs-lang=cpp)