Search code examples
.net-4.0.net-2.0

Create a .NET subapplication with different version than parent


I have a website configured in .NET 2.0, and I cannot change it because of compatibility problems. Inside that website, I have other website in 4.0. So let's think something like this:

RootWebsite --> 2.0

 - Default.aspx
 - Another.aspx
 - PROMOS
     - AnotherWebsite --> 4.0
         -web.config
 - web.config

Well, the AnotherWbesite (4.0) is using some libraries that don't work on 2.0. I don't know why, but when I execute the website, it is executing in 2.0 instead of 4.0, although it has its own web.config and it is configured in 4.0.

Is there any way to force the AnotherWebSite to execute in 4.0, despite its father is in 2.0?

Thank you very much


Solution

  • I have found the solution:

    in the parent's web.config, you have to wrap the "system.web" section into the following:

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

    This way, the children won't inherits anything from the parent, so you can use different .NET versions.