title: IIS7 & forms authentication
body: <p>I've been struggling with this all day. I am trying to add forms authentication to my asp.net web site.</p>
  
  <p>I have disabled Anonymous, Windows, ASP.NET Impersonation and enabled Forms Authentication.</p>
  
  <p>I have created a Login.aspx page and have a Default.aspx page. Default.aspx is the default document.</p>
  
  <p>I have added to web.config:</p>
  
  <pre><code>&lt;authentication mode="Forms"/&gt;
  </code></pre>
  
  <p>This is the behaviour I am experiencing:</p>
  
  <p>1) When testing with http:\localhost\ I get a 401.2 error on the application root.</p>
  
  <p>2) When testing with http:\localhost\Default.aspx I get a 401.2 error on Login.aspx, so redirection is happening but the Login.aspx is giving the error.</p>
  
  <p>So it seems I have no access to any pages on the website even Default.aspx &amp; Login.aspx.</p>
  
  <p>But I canot find a solution, I have even tried:</p>
  
  <pre><code>  &lt;location path="Default.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;allow users="*"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
  
    &lt;location path="Login.aspx"&gt;
      &lt;system.web&gt;
        &lt;authorization&gt;
          &lt;allow users="*"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
  </code></pre>
  
  <p>But this doesn't seem to change anything.</p>
  
  <p>I have also tried </p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
    &lt;forms loginUrl="Login.aspx" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>But this doesn't do anything different either.</p>
  
  <p>Also if I revert to Anonymous or Windows Authentication then the default document redirection works.</p>
  
  <p>I am using asp.net 3.5 on IIS7 on Vista Business.</p>
  
  <p>Please help!</p>