Here at my department we write web applications for multiple sites, based on a CMS, and in the past we have integrated our applications in two different ways. Both ways work, but aren't the most efficient. At first we just deployed our webcontrols on the different sites. This integrates quite well and is workable. That is, if you don't have many sites to maintain. At first we had about 5-10 sites (all deployed on two servers). the amount of sites grew out to about 70. Deployment became quite hard.
The second way of integrating was to deploy every application once on every server. Using IIS virtual directory settings we enabled each site to use each webapplication. Deployment became much easier, but the application didn't share the application context anymore, which gave us some problems. Besides that the technical maintenance of IIS became harder. It's a lot of work to change the settings of all these sites.
There had to be a better way of integration our applications and the sites. The solution had to meets the following requirements:
To meet the first requirement we used an URL rewriter. The other requirements were harder. We found a solution, based on usercontrols as embedded resources. To do this we needed an virtual path provider. This way we could deploy our applications in the GAC and let the sites use the applications trough a proxy usercontrol.
This way application deployment is easy and different site can even choose different application versions. We just need to deploy one usercontrol on each site and we don't need any special IIS settings. The proxy control gets the information on which application to load from the URL which should be in this form:
This way the proxy control can load a specific application assembly. The application must provide a single class (inherits from an interface provided by the proxy control). This interface is provided with the "function" and the "parameter" and has to return the name of the right usercontrol. Using the virtual path provider the control is loaded. This interface is the only specific thing a developer must do. The controls are all default functionality.