WebSecurity - ChangePassword()
WebSecurity object
define
ChangePassword() The method changes the password for the specified user.
C# and VB syntax
WebSecurity.ChangePassword(
userName, oldPassword, newPassword
)
Parameters
| Parameters | Type | Description |
|---|---|---|
| userName | String | Username |
| oldPassword | String | The user's old password |
| newPassword | String | The new password |
Return Value
| Type | Description |
|---|---|
| Boolean | Returns if the password is changed true; otherwise, returns false。 |
Errors and exceptions
In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:
- InitializeDatabaseConnection() The method is not called
- SimpleMembership Not initialized (or disabled in the website configuration)
Technical data
| Name | Value |
|---|---|
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |
WebSecurity object