title: How to deny anonymous users in asp.net core razor pages?
body: <p>How would I deny anonymous users to access any of the razor pages in asp.net core other then a login page?</p>
  
  <p>I tried</p>
  
  <pre><code>    services.AddMvc()
          .AddRazorPagesOptions(options =&gt;
          {
              options.RootDirectory = "/";
              options.Conventions.AllowAnonymousToPage("/Account/Login");
              options.Conventions.AuthorizeFolder("/");
          })
          .SetCompatibilityVersion(CompatibilityVersion.Latest);
  </code></pre>