title: Error to use a section registered as allowDefinition='MachineToApplication' beyond application level
body: <blockquote>
  <p>It is an error to use a section registered as <code>allowDefinition='MachineToApplication'</code> beyond application level.</p>
  </blockquote>
  <p>The top line in all of my aspx pages in my <code>/portal/</code> directory has this error message, and I know it's a common one. I have googled this error message to no end, and I see a lot of posts telling me to configure the <code>/portal/</code> folder as an application in IIS (which I have), and more posts telling me I have nested <code>web.config</code>s (but none of the postings offer guidance toward a solution).</p>
  <p>My setup is that I have a <code>web.config</code> in my root directory, and then I'm trying to make a company portal, in the <code>/portal/</code> directory. The <code>/portal/</code> directory has its own (necessary) <code>web.config</code>.</p>
  <p>My web.config line 50 is like this:</p>
  <pre><code>&lt;customErrors mode=&quot;Off&quot; defaultRedirect=&quot;customerrorpage.aspx&quot;/&gt;
  &lt;anonymousIdentification enabled=&quot;true&quot;/&gt;
  &lt;authentication mode=&quot;Forms&quot;/&gt;
  &lt;membership defaultProvider=&quot;MyProvider&quot;&gt;
  </code></pre>
  <p>So I have <code>domain.example/web.config</code> and <code>domain.example/portal/web.config</code> ... so my <code>domain.example/portal/default.aspx</code> page will not load.</p>
  <p>What is the real solution to this? Do I somehow find a way to merge my root <code>web.config</code> with my <code>/portal/</code> directory <code>web.config</code>, or am I way off base here?</p>