Latest web development tutorials

WebSecurity ChangePassword 方法

WebSecurity 對象 WebSecurity對象

定義

ChangePassword()方法為指定的用戶更改密碼。


C# 和VB 語法

WebSecurity.ChangePassword( userName, oldPassword, newPassword )


參數

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


返回值

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


錯誤和異常

在下面的情況下,任何對WebSecurity對象的訪問將拋出一個InvalidOperationException

  • InitializeDatabaseConnection()方法沒有被調用
  • SimpleMembership沒有初始化(或者在網站配置中禁用)

技術數據

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


WebSecurity 對象 WebSecurity對象