Combining Silverlight 2 content from multiple web applications in VS2008

Standard

 image

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:

image

You can then access the web application directly:

<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="http://localhost:2000/Crm_Web/ClientBin/TechnologyOneCrm.xap" Version="2.0" Width="100%" Height="100%" />
    </div>
</form>

There’s probably many better solutions to this problem, but I thought I’d post my workaround.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s