Maybe could help the approach used
in this tutorial[
^]:
- create a subfolder (e.g.
Members);
- put files you want to protect into this subfolder;
- in the
Members subfolder, create a file named
_PageStart.cshtml. When any page in the subfolder is requested, this page runs first;
- in the
_PageStart.cshtml file, call
WebSecurity.IsAuthenticated to determine whether the user is logged in. If they are not, redirect them to the login page.