Combining Silverlight 2 content from multiple web applications in VS2008
Posted by anoriginalidea on May 30, 2008
In a project I’m doing I need to create a web application that can consume Silverlight 2 RIA content from other web applications.
As it turns out, this is pretty easy to do. All you need to do is reference the xap in the other web application from your page and it works exactly the same as if you were using an xap from within your own web application.
A Problem with Debugging
One problem is that Visual Studio tries to run the two web applications on different ports, which makes it impossible to reference the other web app directly. You can’t use a relative url:
<form id="form1" runat="server" style="height:100%;">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="height:100%;">
<asp:Silverlight ID="Xaml1" runat="server" Source="../Crm_Web/ClientBin/TechnologyOneCrm.xap" Version="2.0" Width="100%" Height="100%" />
</div>
</form>
Therefore you need to set the web application you wish to point to on a static port, like this:
You can then access the web application directly:
<form id="form1" runat="server" style="height:100%;">
There’s probably many better solutions to this problem, but I thought I’d post my workaround.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div style="height:100%;">
<asp:Silverlight ID="Xaml1" runat="server" Source="http://localhost:2000/Crm_Web/ClientBin/TechnologyOneCrm.xap" Version="2.0" Width="100%" Height="100%" />
</div>
</form>

