Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

WebSecurity CurrentUserName Property

WebSecurity Property - CurrentUserName


WebSecurity Object WebSecurity object


define

CurrentUserName The property is the current user's WebSecurity The name in the user profile table in the database.


C# and VB syntax

WebSecurity.CurrentUserName


Example

Example C#

@{

string value;

value=WebSecurity.CurrentUserId;

}

Welcome @value

Example VB

@Code

Dim value as String

value=WebSecurity.CurrentUserName

End Code

Welcome @value


Notes

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


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

WebSecurity Object WebSecurity object