Usercontrol in MOSS and/or different webapplication

Topics: Web Client Software Factory
Mar 11, 2008 at 10:52 AM
I created a web UI solution using WCSF. This solution consists of aspx pages hosted on IIS. This works fine.

On this web solution, I created another webapplication I want to create a user control available for a MOSS smartpart and then publish to the MOSS server.

There are 2 questions:
1. What do I have to do to Copy/Move this user control to another web application. What other dependencys are there?
2. Is it possible to create more than 1 web application that share the same business module? WCSF 2.0 does not allow me to add new web application.

Any guidance or best practice ?

VS 2008
WCSF 2.0
Mar 11, 2008 at 6:03 PM
We did not do any work or testing with MOSS smartparts. My understanding is that while this might work, your shared user control should work if the other web app is a WCSF app. If it is not a WCSF app, then things like services, dependency injection, and a number of other WCSF features will not work. However, if this is just a "plain" user control that does not make use of any WCSF features, it might work.

Good luck,
Michael Puleio - patterns & practices
Mar 12, 2008 at 7:48 AM
Edited Mar 12, 2008 at 8:37 AM
In fact thats the issue. Other web applications may not be WCSF app . (It contains only the usercontrols to be exported to MOSS)

When I make it WCSF app it causes the error converting Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication to CompositeWeb.WebClientApplication

and the other issue is the global.asax file, I cannot add this to MOSS:
@ Application Language="C#" Inherits="Microsoft.Practices.CompositeWeb.WebClientApplication"

After trying several methods getting another error at MOSS webpart: Unable to cast object of type 'ASP.global_asax' to type 'Microsoft.Practices.CompositeWeb.WebClientApplication'
Mar 13, 2008 at 1:15 AM
It looks like you answered your own question.
There appears to be an incompatibility between WCSF apps and MOSS apps.
Since you have the source code, you might be able to get WebClientApplication to derive from Microsoft.SharePoint.ApplicationRuntime.SPHttpApplication and get something to work.
Good luck, if you do try.

Michael Puleio - patterns & practices
Sep 9, 2008 at 2:18 PM



We published two new releases that provides guidance on:

·         Enabling CWAB in a SharePoint Application

·         Enabling Unity in a SharePoint Application


These releases include the following elements:

·         A PDF document with guidance to enable CWAB/Unity in a SharePoint application to make Web Parts more testable.

·         Extensions for CWAB/Unity to work on a SharePoint application

o   CompositeWeb.SharePoint solution: it includes a class that implements the IWebClientApplication interface and inherits from SPHttpApplication class.

o   Unity.SharePoint solution: it includes a class that inherits from SPHttpApplication and hosts a Unity container.

·         A sample implementation that uses the extensions for CWAB/Unity This solution includes a web part that injects dependencies (also has a Unit Test project).

·         Sample files like the global.asax and web.config for a SharePoint application enabled with CWAB/Unity.


We also published the documentation guidance in the WCSF KB as wiki pages. You can find them here:

·         How To: Enable CWAB in a SharePoint Application

·         How To: Enable Unity in a SharePoint Application to make Web Parts more testable


Please, let me know if it helps.


Mariano Converti