WebSecurity - UserExists()


WebSecurity 对象WebSecurity Object

Definition

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


C# and VB Syntax

WebSecurity.UserExists(userName)


Parameters

Parameters Type Description
userName String User name


Return Value

Type Description
Boolean If the user already exists, returnstrue, otherwise returnsfalse。


Errors and Exceptions

In the following cases, anyWebSecurityaccess to the object will throw anInvalidOperationException:

  • InitializeDatabaseConnection() method has not been called
  • SimpleMembershipnot initialized (or disabled in the website configuration)

Remarks

UserExists()The method only verifies whether the user already exists in the user profile table.

itIt does notverify for the user whether a membership account already exists, or whether the user is confirmed, or whether the user is logged in.


Technical Data

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


WebSecurity 对象WebSecurity Object Other Extensions