WebSecurity - UserExists()


WebSecurity 對象 WebSecurity 對象

定義

UserExists() 方法指示用戶是否已存在於 WebSecurity 資料庫中。


C# 和 VB 語法

WebSecurity.UserExists(userName)


參數

參數 類型 描述
userName String 用戶名


返回值

類型 描述
Boolean 如果用戶已存在,則返回 true,否則返回 false


錯誤和異常

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

  • InitializeDatabaseConnection() method has not been called
  • SimpleMembership 沒有初始化(或者在網站配置中禁用)

備註

UserExists() 方法只驗證用戶是否已存在於用戶資料表中。

不會為用戶驗證會員帳戶是否已存在,或者用戶是否已確認,或者用戶是否已登錄。


技術數據

名稱
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity 對象 WebSecurity 對象