Easy Tutorial
❮ Prop Webcontrol Tablecell Text Control Dropdownlist ❯

WebSecurity Property - CurrentUserId



Definition

The CurrentUserId property is the ID (primary key) of the current user in the WebSecurity database.


C# and VB Syntax


Example

Example C

Example VB


Remarks

The CurrentUserId property is read-only. It cannot be changed through code.

This property is used to identify the user in the user profile table and membership table in the WebSecurity database.


Errors and Exceptions

If no user is currently logged in, the CurrentUserId property returns -1.

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

❮ Prop Webcontrol Tablecell Text Control Dropdownlist ❯