Click here to Skip to main content
14,176,371 members
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 4 Oct 2008
Licenced CPOL 2.0 website as a sub application of a 1.1 website

, 4 Oct 2008
Rate this:
Please Sign up or sign in to vote.
How to configure an 2.0 as a sub app of an 1.1 application


Here's how to configure an 2.0 web application as a SUB APPLICATION of an existing 1.1 application.

By design the root website, “inherit down” the config file to all sub applications.

When the sub application loads, the runtime loads the config file from the root application and inherits down to all sub applications. This can be useful, sub apps can now inherit from the configuration of the root application, But this usefulness sometimes can cause us a problem when the web.config file adds
 assemblies
 httpModules
 httHeaders

When you access the 2.0 sub site, the runtime tries to load the modules, assemblies and headers referenced in the root web.config, by looking in the 2.0 bin directory. The runtime will not find these in the bin directory and throw an exception.

Now there's a couple ways to resolve this.
1. Copy the dlls to the sub applications bin folder
2. configure the sub application to remove the referenced dlls.


Firstly, I've only tested this against IIS 6.

Assuming your 1.1 web app is configured and working and you've created and configured your 2.0 app as a sub application within IIS 6.0. The first thing to ensure is that your 2.0 app uses its own app pool. The credentials can match your 1.1 app, but its important to have its own app pool.

Now lets assume your root (1.1) application has the following section in the web.config file

<httpmodules />
 <add name="Module1" type="MySuperApp.Modules, MySuperApp.Modules.Module1" />
</httpmodules />
<compilation batch="true" debug="true" defaultlanguage="vb" batchtimeout="30" />
 <assemblies />
  <add assembly="MySuperApp.Specialized.Utilis" />
  <add assembly="MySuperApp.SomeOtherStuff" />
 </assemblies />
</compilation />
<httphandlers />
 <add type="MySuperApp.Handlers.BobHandler, MySuperApp.Bob" validate="false" path=".bob" verb="GET" /> 
</httphandlers />

The above references tell the runtime to load up the required dlls.
As we know, the web.config is “inherited down” to the sub applications.
So within the sub applications config file, we remove the references.
The 2.0 apps web.config file should contain the following…

<compilation debug="true">
<remove assembly="MySuperApp.Specialized.Utilis" />
<remove assembly="MySuperApp.SomeOtherStuff" />
<add name="Session" type="System.Web.SessionState.SessionStateModule"/> 
<remove verb="GET" path=".bob" />

These are all within the system.web node.
Take special note of the httpModules section. I’ve issued a Clear and not a explicit
remove. This is done so that the sub application can be scaled to
a full root (standalone) website without the need to amend the config file.

Points of Interest

This seems to work for my particular situation, however there's others that claim it does not work and as a last resort have to include the dlls in the bin folder. If there's any other solutions out there, I'd appreciate it if you could share.


Created: 05 October 2008 :

Hope this helps!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Zakir Hoosen
Software Developer (Senior)
United Kingdom United Kingdom
You can read my blog at

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190525.1 | Last Updated 4 Oct 2008
Article Copyright 2008 by Zakir Hoosen
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid