MSDN Library

WebSecurity.ChangePassword Method

Changes the password for the specified user.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

Public Shared Function ChangePassword ( _
	userName As String, _
	currentPassword As String, _
	newPassword As String _
) As Boolean
Dim userName As String
Dim currentPassword As String
Dim newPassword As String
Dim returnValue As Boolean

returnValue = WebSecurity.ChangePassword(userName, _
	currentPassword, newPassword)


Type: System.String
The user name.
Type: System.String
The current password for the user.
Type: System.String
The new password.

Return Value

Type: System.Boolean
true if the password is successfully changed; otherwise, false.


The SimpleMembershipProvider.Initialize(String, NameValueCollection) method was not called.


The InitializeDatabaseConnection method was not called.


The SimpleMembershipProvider membership provider is not registered in the configuration of your site. For more information, contact your site's system administrator.

For an example of how to use the ChangePassword(String, String, String) method, see the ChangePassword.cshtml file in the Starter Site template.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.
© 2016 Microsoft