WebSecurity - IsCurrentUser()
WebSecurity Object
Definition
IsCurrentUser()The method compares the provided user name with the user name of the logged-in user.
C# and VB Syntax
WebSecurity.IsCurrentUser(userName)
Parameters
| Parameters | Type | Description |
|---|---|---|
| userName | String | The user name to compare. |
Return Value
| Type | Description |
|---|---|
| Boolean | IfuserNamematches the logged-in user, then returnstrue; otherwise returnsfalse。 |
Errors and Exceptions
In the following cases, any access toWebSecuritythe object will throw anInvalidOperationException:
- InitializeDatabaseConnection()The method has not been called.
- SimpleMembershipnot initialized (or disabled in website configuration)
Technical Data
| Name | Value |
|---|---|
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |
WebSecurity Object Other Extensions