WebSecurity - UserExists()
WebSecurity object
define
UserExists() The method indicates whether the user already exists in the WebSecurity database.
C# and VB syntax
WebSecurity.UserExists(
userName
)
Parameters
| Parameters | Type | Description |
|---|---|---|
| userName | String | Username |
Return Value
| Type | Description |
|---|---|
| Boolean | Returns if the user already exists true; otherwise, returns false。 |
Errors and exceptions
In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:
- InitializeDatabaseConnection() method has not been called
- SimpleMembership Not initialized (or disabled in the website configuration)
Notes
UserExists() The method only verifies whether the user exists in the user profile table.
ItIt does notverify for the user whether the 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 object