Latest web development tutorials

WebSecurity UserExists method

WebSecurity objects WebSecurity objects

definition

UserExists () method indicates whether the user already exists in WebSecurity database.


C # and VB syntax

WebSecurity.UserExists( userName )


parameter

参数 类型 描述
userName 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)

Remark

UserExists () method only to verify whether the user is present in the user data table.

It does not verify that the user account already exists member, or if the user has to confirm, or whether the user has logged in.


Technical data

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


WebSecurity objects WebSecurity objects