title: Dynamically deny access to locations
body: <p>I'm looking to dynamically instruct ASP.NET to deny access to specific locations. So, instead of having something like the following in the Web.config, I'd like to do that through C# code.</p>
  
  <blockquote>
  <pre><code>&lt;location path="specialDir"&gt;
      &lt;system.webServer&gt;
          &lt;security&gt;
              &lt;authorization&gt;
                  &lt;add accessType="Deny"
                       roles="FileDeny" /&gt;
              &lt;/authorization&gt;
          &lt;/security&gt;
      &lt;/system.webServer&gt;
  &lt;/location&gt;
  </code></pre>
  </blockquote>
  
  <p>Any ideas?</p>