title: Multiple/Different authentication settings in web.config
body: <p>How would I go about setting different authentication tags for different parts of my web app?  Say I have:</p>
  
  <pre><code>/
  /folder1/
  /folder2/
  </code></pre>
  
  <p>Would it be possible to specify different <code>&lt;authentication/&gt;</code> tags for each folder?</p>
  
  <p>I want folder1 to use Windows authentication but folder2 use Forms authentication.  </p>
  
  <p>I tried doing in a <code>&lt;location/&gt;</code> tag but it doesn't look like you can have <code>&lt;authentication/&gt;</code> tags in a <code>&lt;location/&gt;</code> tags, at least not via VS 2008 with it's built in webserver.</p>
  
  <p>This errors out saying - Error  3   It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.      </p>
  
  <pre><code>&lt;location path="/folder1"&gt;
      &lt;system.web&gt;
        &lt;authentication mode="Forms" /&gt;
        &lt;authorization&gt;
          &lt;deny users="?"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
  </code></pre>