title: Web.Config Inheritance Problem
body: <p>I want to prevent the parent config in our IIS 7 app from pushing down the following section to any sub web.configs in any applications under the parent application.</p>
  
  <pre><code>    &lt;configSections&gt;
          &lt;sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
              &lt;sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
                  &lt;section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
                  &lt;sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt;
                      &lt;section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /&gt;
                      &lt;section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
                      &lt;section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
                      &lt;section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /&gt;
                  &lt;/sectionGroup&gt;
              &lt;/sectionGroup&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
  </code></pre>
  
  <p>The reason I need to remove that section is because the sub application doesn't need this or even use it.  So when the parent passes it down and I try to run that sub app, I get the following during runtime:</p>
  
  <pre><code>Unable to cast object of type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection' to type 'System.Web.Configuration.ScriptingScriptResourceHandlerSection'
  </code></pre>
  
  <p>I see no way to prevent the configSections from being applied downward to child application web.configs.  You cannot wrap it with <code>&lt;location&gt;</code> around this particular section and adding a <code>&lt;clear/&gt;</code> only causes another error message which is:</p>
  
  <pre><code>The configuration section 'appSettings' cannot be read because it is missing a section declaration 
  </code></pre>