title: Forms Authentication redirects to sign in page constantly
body: <p>I'm implementing forms authentication on IIS 10. This strikes me as being very easy but it isn't working as expected. As a result i have taken the bare minimum of code from my project and built a test page.</p>
  <p>I have a simple application setup in IIS with one page, set as the default (http://[my.site]/mike/intro.aspx), and with forms authentication enabled.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
          &lt;authentication mode=&quot;Forms&quot;&gt;            
            &lt;forms cookieless=&quot;UseCookies&quot; defaultUrl=&quot;intro.aspx&quot; loginUrl=&quot;/auth/test.aspx&quot; name=&quot;.ASPXFORMS&quot; protection=&quot;Encryption&quot; timeout=&quot;30&quot; /&gt;
          &lt;/authentication&gt;
        &lt;authorization&gt;
          &lt;deny users=&quot;?&quot; /&gt;
          &lt;allow users=&quot;*&quot; /&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>The page that does the authentication is in its own app (http://[my.site]/auth/test.aspx) and currently goes to a very simple piece of code that creates the forms authentication cookie and provides a link back to the original application.</p>
  <pre><code>Partial Class signin
      Inherits System.Web.UI.Page
  
      Private Sub signin_Load(sender As Object, e As EventArgs) Handles Me.Load
  
          Dim userid As String = &quot;mike&quot;
  
          Dim formAuthTicket As FormsAuthenticationTicket = New FormsAuthenticationTicket(1, userid, DateTime.Now, DateTime.Now.AddMinutes(30), True, &quot;test data&quot;)
          Dim formCookieString As String = FormsAuthentication.Encrypt(formAuthTicket)
          Dim formCookie As HttpCookie = New HttpCookie(&quot;.ASPXFORMS&quot;, formCookieString)
          formCookie.Expires = formAuthTicket.Expiration
          formCookie.Path = FormsAuthentication.FormsCookiePath
          Response.Cookies.Add(formCookie)
  
          'Response.Redirect(Request.QueryString(&quot;ReturnUrl&quot;), True)
  
      End Sub
  
  End Class
  </code></pre>
  <p>I had to comment out the auto redirect as it causes a redirect loop.</p>
  <p>I've checked after running this code and the correct cookie is created but when going back to the original page where the forms authentication is enabled, i get sent straight back to the sign in page.</p>
  <p>I feel i am missing something obvious but i can't see it. Any help would be greatly appreciated.</p>