WebSecurity - IsCurrentUser()
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:
- InitializeDatabaseConnection() The method is not called
- SimpleMembership Not initialized (or disabled in the website configuration)
Technical data
| Name | Value |
|---|---|
| Namespace | WebMatrix.WebData |
| Assembly | WebMatrix.WebData.dll |
WebSecurity object