Latest web development tutorials

WebSecurity ChangePassword method

WebSecurity objects WebSecurity objects

definition

ChangePassword () method to change the password for the specified user.


C # and VB syntax

WebSecurity.ChangePassword( userName, oldPassword, newPassword )


parameter

参数 类型 描述
userName String 用户名
oldPassword String 用户的旧密码
newPassword String 新密码


return value

类型 描述
Boolean 如果密码被更改,则返回 true ,否则返回 false


Errors and exceptions

In the following scenario, any access to WebSecurity object will throw an InvalidOperationException:

  • InitializeDatabaseConnection () method has not been called
  • SimpleMembership not initialized (or disabled in the site configuration)

Technical data

名称
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity objects WebSecurity objects