Export (0) Print
Expand All

WebSecurity.RequireUser Method

If the current user is not the specified user, sets the HTTP status to 401 (Unauthorized).

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Public method Static member RequireUser(Int32) If the specified user is not logged on, sets the HTTP status to 401 (Unauthorized).
Public method Static member RequireUser(String) If the current user does not match the specified user name, sets the HTTP status to 401 (Unauthorized).
Top

To validate that the user is authenticated, use the RequireAuthenticatedUser() method. To validate that a user is a member of a role or set of roles, use the RequireRoles(String[]) method.

NoteNote:

This method will let only the specified user access the web page. The recommended way to restrict access to a web page is to create a role, and use the RequireRoles(String[]) method to verify that the current user is a member of that role.

Show:
© 2014 Microsoft