Easy Tutorial
❮ Control Label Prop Webcontrol Standard Style ❯

WebSecurity Property - HasUserId


Definition

The HasUserId property is a Boolean value that indicates whether the current user has a user ID in the WebSecurity database.

If the current user has a user ID, the property value is a Boolean true. By default, it is false.


C# and VB Syntax


Examples

Example C

Example VB


Remarks

The HasUserId property is read-only. It cannot be changed via code.

The HasUserId property only verifies if the user has an ID in the WebSecurity database. It does not verify if the user account is valid (confirmed), or if the user is logged in.

Use the IsConfirmed() method to verify if the user has been confirmed.

Use the IsAuthenticated property to verify if the user is logged in.


Errors and Exceptions

In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:


Technical Data

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

❮ Control Label Prop Webcontrol Standard Style ❯