RequireAuthenticatedUser (WebSecurity Ref)

The RequireAuthenticatedUser method only allows logged in users to access a certain page or directory. It takes no arguments.

Example

If you want to apply login to a directory in ASP.NET WebPages place this in the _PageStart.cshtml file:

@{
WebSecurity.RequireAuthenticatedUser();
}