title: Owin Authentication creates a redirect loop
body: <p>I have an ASP.NET 4.6 WebForms application which exploits the Identity 2.1 package for the registration and authentication system. It uses <strong>Owin authentication</strong>, not Forms or Windows.</p>
  
  <p>My attempt is to allow no anonymous user to see any page of the website and to redirect them to the Login page. This is why I have added the following in my Web.config (according to <a href="http://www.codeproject.com/Articles/751897/ASP-NET-Identity-with-webforms" rel="nofollow">this article</a>) :</p>
  
  <pre><code>&lt;system.web&gt;
      &lt;authorization&gt;
        &lt;deny users="?"/&gt;
      &lt;/authorization&gt;
      &lt;authentication mode="None" /&gt;
  &lt;/system.web&gt;
  
  &lt;location path="~/Account/Login.aspx"&gt;
  &lt;system.web&gt;
    &lt;authorization&gt;
      &lt;allow users="*"/&gt;
    &lt;/authorization&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>
  <p>Since then, I always get a Redirect Loop when running the app in the browser. I have found different solutions for MVC, but none for WebForms. 
  <p>What may be the cause and how to remove it?</p>
  
  <p>This is my Configuration method in the Startup.Auth.cs file:</p>
  
  <pre><code>public void ConfigureAuth(IAppBuilder app)
      {
          app.CreatePerOwinContext(ApplicationDbContext.Create);
          app.CreatePerOwinContext&lt;ApplicationUserManager&gt;(ApplicationUserManager.Create);
          app.CreatePerOwinContext&lt;ApplicationRoleManager&gt;(ApplicationRoleManager.Create);
          app.CreatePerOwinContext&lt;ApplicationSignInManager&gt;(ApplicationSignInManager.Create);
          app.UseCookieAuthentication(new CookieAuthenticationOptions
          {
              AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
              LoginPath = new PathString("/Account/Login.aspx"),
              CookieSecure = CookieSecureOption.Always,
              Provider = new CookieAuthenticationProvider
              {
                  OnValidateIdentity = SecurityStampValidator.OnValidateIdentity&lt;ApplicationUserManager, ApplicationUser&gt;(
                      validateInterval: TimeSpan.FromMinutes(30),
                      regenerateIdentity: (manager, user) =&gt; user.GenerateUserIdentityAsync(manager))
              }
          });
      }
  </code></pre>