title: Configuring subdirectory authentication mode in applications hosted under root site
body: <p>On my local machine, I work on multiple web sites and run them under IIS under a "Default" web site.  That way I can access the sites through this type of URL: <a href="http://localhost/App1/" rel="noreferrer">http://localhost/App1/</a>. Here's the structure:</p>
  
  <pre>
  LocalDev (site)
      App1 (application)
      App2 (application)
      App3 (application)
  </pre>
  
  <p>The problem I'm encountering is that in App1, I'm trying to enable Windows authentication on a subdirectory of App1, like this:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;location path="internal"&gt;
      &lt;system.web&gt;
        &lt;authentication mode="Windows"/&gt;
        &lt;authorization&gt;
          &lt;allow users="*"/&gt;
        &lt;/authorization&gt;
      &lt;/system.web&gt;
    &lt;/location&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Unfortunately, when I then try to access <a href="http://localhost/App1/internal/url.aspx" rel="noreferrer">http://localhost/App1/internal/url.aspx</a>, I get this error:</p>
  
  <blockquote>
    <p>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>
  </blockquote>
  
  <p><code>App1</code> is set up as an application, not a virtual directory.  I've tried changing my machine.config to allow changing the authentication section anywhere:</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="system.web" type="System.Web.Configuration.SystemWebSectionGroup, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&gt;
        &lt;section name="authentication" type="System.Web.Configuration.AuthenticationSection, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" allowDefinition="Everywhere"/&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>What do I have to do to allow my sites to set their own authentication modes?</p>