Tutorials References Exercises Videos NEW Menu
Paid Courses Website NEW

WebSecurity - IsCurrentUser()


❮ WebSecurity

Definition

The IsCurrentUser() method compares a provided username with the logged in user's username.


C# and VB Syntax

WebSecurity.IsCurrentUser(userName)

Parameters

Parameter Type Description
userName String The user name to compare

Return Value

Type Description
Boolean true if the userName parameter matches the logged in user, otherwise false

Errors and Exceptions

Any access to the WebSecurity object throws an InvalidOperationException if:

  • The InitializeDatabaseConnection() method has not been called
  • SimpleMembership is not initialized (or disabled in the website configuration)

❮ WebSecurity