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

WebSecurity RequireAuthenticatedUser Method

WebSecurity - RequireAuthenticatedUser()


WebSecurity Object WebSecurity object


define

If the current user is not authenticated,RequireAuthenticatedUserthe **()** method sets the HTTP status to 401 (Unauthorized).


C# and VB syntax

WebSecurity.RequireAuthenticatedUser()


Parameters

none.


Return Value

none.


Errors and exceptions

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


Notes

RequireAuthenticatedUser() The value verifies whether the current user is authenticated. If the current user is not authenticated, the HTTP status is set to 401 (Unauthorized).

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


Technical data

Name Value
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll

WebSecurity Object WebSecurity object