<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>

[{'answer_id': 37762, 'author': 'John Owen', 'author_id': 2471, 'author_profile': 'https://Stackoverflow.com/users/2471', 'pm_score': 5, 'selected': True, 'text': '<p>I\'ve found the answer.  Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false.</p>\n\n<pre><code>&lt;location path="." inheritInChildApplications="false"&gt;\n  &lt;system.web&gt;\n    &lt;httpModules&gt;\n      &lt;add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/&gt;\n    &lt;/httpModules&gt;\n  &lt;/system.web&gt;\n&lt;/location&gt;\n</code></pre>\n\n<p>Now any virtual directories will not inherit the settings in this location section.</p>\n\n<p>@GateKiller This isn\'t another website, its a virtual directory so inheritance does occur.</p>\n\n<p>@petrich I\'ve had hit and miss results using <code>&lt;remove /&gt;</code>.  I have to remember to add it to every virtual directory which is a pain.</p>\n'}, {'answer_id': 37763, 'author': 'rpetrich', 'author_id': 4007, 'author_profile': 'https://Stackoverflow.com/users/4007', 'pm_score': 2, 'selected': False, 'text': '<p>Add the following to the virtual directory\'s web.config file:</p>\n\n<pre><code>&lt;httpModules&gt;\n    &lt;remove name="ChartStreamHandler"/&gt;\n&lt;/httpModules&gt;\n</code></pre>\n'}, {'answer_id': 37766, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': -1, 'selected': False, 'text': '<p><a href="http://msdn.microsoft.com/en-us/library/ms178685.aspx" rel="nofollow noreferrer">According to Microsoft</a>, other websites do not inherit settings from the Default Website. Do you mean you are editing the default web.config which is located in the same folder as the machine.config?</p>\n'}]
['https://Stackoverflow.com/questions/37759', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2471/']