IIS7: disabling HttpModule in subapplication - sites, application and virtual directories

JKG has the right answer for IIS6, but the syntax is a little different in IIS7:

<system.webServer>
  <modules>
    <remove name="MyModule"/>
  </modules>
</system.webServer>

The web.config will always inherit from its parent if it's in the same web application but you can clear the entire thing or remove an item like so:

From the child web.config (clear all or remove an item)

<httpModules>
  <clear />
  <remove name="MyModule"/>
</httpModules>  

From the parent config by using the location tag...

<location inheritInChildApplications="false">
  <system.web>
    <!-- ... -->
  </system.web>
</location>

http://www.jaylee.org/post/2008/03/Prevent-ASPNET-webconfig-inheritance-and-inheritInChildApplications-attribute.aspx