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

WebSecurity IsCurrentUser Method

WebSecurity - IsCurrentUser()


WebSecurity Object WebSecurity object


define

IsCurrentUser() The method compares the provided username with the username of the logged-in user.


C# and VB syntax

WebSecurity.IsCurrentUser(

userName

)


Parameters

Parameters Type Description
userName String The username to compare

Return Value

Type Description
Boolean If both the userName Returns if it matches the logged-in user true; otherwise, returns false。

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