title: Prevent access to a particular AREA in .Net MVC
body: <p>The admin section of a MVC3 website is created as an Area. I then put the following code in the Web.config</p>
  
  <pre><code>&lt;location path="Admin"&gt;
  &lt;system.web&gt;
    &lt;authentication mode="Forms"&gt;
      &lt;forms loginUrl="~/Admin/Login/Login" timeout="5000" defaultUrl="~/Admin/Login/Redirect" /&gt;
    &lt;/authentication&gt;
    &lt;authorization&gt;
      &lt;deny users="?"/&gt;
    &lt;/authorization&gt;
  &lt;/system.web&gt;
  &lt;/location&gt;
  </code></pre>
  
  <p>However it throws an error</p>
  
  <blockquote>
    <p>Parser Error Message: 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>Source Error: </p>
  
  <pre><code>Line 44:   &lt;location path="Admin"&gt;
  Line 45:     &lt;system.web&gt;
  Line 46:       &lt;authentication mode="Forms"&gt;
  Line 47:         &lt;forms loginUrl="~/Admin/Login/Login" timeout="5000" defaultUrl="~/Admin/Login/Redirect" /&gt;
  Line 48:       &lt;/authentication&gt;
  </code></pre>