<p>I have the following code in a web.config file of the default IIS site.</p>

<pre><code>&lt;httpModules&gt;
    &lt;add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/&gt;
&lt;/httpModules&gt;
</code></pre>

<p>Then when I setup and browse to a virtual directory I get this error</p>

<p>Could not load file or assembly 'Charts' or one of its dependencies. The system cannot find the file specified.</p>

<p>The virtual directory is inheriting the modules from the default web.config.</p>

<p>How do you stop this inheritance?</p>

I've found the answer.  Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false.
```
```
<location path="." inheritInChildApplications="false">
  <system.web>
    <httpModules>
      <add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/>
    </httpModules>
  </system.web>
</location>
```
```
Now any virtual directories will not inherit the settings in this location section.
@GateKiller This isn't another website, its a virtual directory so inheritance does occur.
@petrich I've had hit and miss results using
```
<remove />
```
.  I have to remember to add it to every virtual directory which is a pain.