If you have ever had the scenario where you have a main ASP.NET web application and then need to create one or more sub virtual folders that contain completely independant applications (different authentication, error pages, etc), then you have probably run up against the need to prevent the normal web.config inheritianace. Do do this is pretty simple, just setup the PARENT web.config like this
<!-- Root web.config file --> <?xml version="1.0"?> <configuration> <location path="." inheritInChildApplications="false"> <system.web> <compilation debug="false" /> <!-- other configuration attributes --> </system.web> </location> </configuration>
The one catch when doing this is that you’ll probably notice Visual Studio compain about the “inheritInChildApplications” attribute. Turns out this is because the Schema XSD files for web.config that shipped with VS2005/2008/2010 left out support for this attribute (Note: this doesn’t prevent your app from work, it just means VS IDE will complain).
To fix this, open up the following files located in %ProgramFiles%Microsoft Visual Studio XXXmlSchemas (XX is 8.0, 9.0, or 10.0 depending on your version)
For each of the files — Find the <xs:element name=”location”> tag and change it to look like this
<xs:element name="location"> <xs:complexType> <xs:choice> <xs:any namespace="##any" processContents="lax" /> </xs:choice> <xs:attribute name="path" type="xs:string" use="optional" /> <xs:attribute name="allowOverride" type="small_boolean_Type" use="optional" /> <xs:attribute name="inheritInChildApplications" type="xs:boolean" use="optional" /> </xs:complexType> </xs:element>
Basically what you are doing is adding this one line to that complex type declaration
<xs:attribute name="inheritInChildApplications" type="xs:boolean" use="optional" />
And thatsit — you’re good to go.