WebSecurity - ChangePassword()


WebSecurity 对象WebSecurity Object

Definition

ChangePassword()Method changes the password for the specified user.


C# and VB Syntax

WebSecurity.ChangePassword(userName, oldPassword, newPassword)


Parameters

Parameters Type Description
userName String User name
oldPassword String The user's old password
newPassword String New password


Return Value

Type Description
Boolean If the password is changed, then returnstrue, otherwise returnsfalse。


Errors and Exceptions

In the following cases, any access toWebSecuritythe object will throw anInvalidOperationException:

  • InitializeDatabaseConnection()The method has not been called
  • SimpleMembershipNot initialized (or disabled in website configuration)

Technical Data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity 对象WebSecurity Object Other Extensions