How to use a .NET 4.0 web application within a .NET 3.5 web application? How to use a .NET 4.0 web application within a .NET 3.5 web application? asp.net asp.net

How to use a .NET 4.0 web application within a .NET 3.5 web application?


Web.config inheritance is unfortunately not something you can turn off completely; Specifically, the top section in the web.config that defines which config sections exist in the web.config cannot be ignored/overridden inside a child application.

The solution is documented here(asp.net 4 breaking changes documentation); Essentially you have to move the values that are currently in the top application up into a machine/FrameworkVersion specific config file and then wrap all(or at least, most) of your root web.config in a location tag with inheritence disabled.


Have you tried setting the "inheritInChildApplications" attribute to "false" in the parent folder's web.config file?

See Saul Dolgin's answer to a similar question for how to do this.


In my applications I more or less succeed with nested applications by using the <location> element together with <clear /> and similar elements in the web.config.

This is an excerpt from a web.config file of mine:

...<!-- Do not inherit. --><location path="." inheritInChildApplications="false">    <system.web>        ...

The idea is to put all sections that you do not want to inherit to child applications within those location elements, as in my example above.