Met Websecurity Changepassword
# WebSecurity - ChangePassword()
* * WebSecurity Object](#)
* * *
## Definition
The **ChangePassword()** method changes the password for a specified user.
* * *
## C# and VB Syntax
WebSecurity.ChangePassword(_userName, oldPassword, newPassword_)
* * *
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| _userName_ | String | The username |
| _oldPassword_ | String | The user's old password |
| _newPassword_ | String | The new password |
* * *
## Return Value
| Type | Description |
| --- | --- |
| Boolean | Returns **true** if the password was changed, otherwise **false**. |
* * *
## Errors and Exceptions
In the following cases, any access to the **WebSecurity** object will throw an **InvalidOperationException**:
* The **InitializeDatabaseConnection()** method has not been called
* **SimpleMembership** is not initialized (or is disabled in the site configuration)
* * *
## Technical Data
| Name | Value |
| --- | --- |
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |
* * WebSecurity Object](#)
YouTip