Easy Tutorial
❮ Prop Webcontrol Style Forecolor Aspnet Ref Validationcontrols ❯

WebSecurity - RequireAuthenticatedUser()



Definition

The RequireAuthenticatedUser() method sets the HTTP status to 401 (Unauthorized) if the current user is not authenticated.


C# and VB Syntax


Parameters

None.


Return Value

None.


Errors and Exceptions

In the following cases, any access to the WebSecurity object will throw an InvalidOperationException:


Remarks

The RequireAuthenticatedUser() method checks if the current user is authenticated. If the current user is not authenticated, the HTTP status is set to 401 (Unauthorized).

To verify if the current user is a specific user (by ID or by name), use the RequireUser() method. To verify if the user is a member of a role, use the RequireRoles() method.


Technical Data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll
❮ Prop Webcontrol Style Forecolor Aspnet Ref Validationcontrols ❯