Embedding Silverlight in an existing application

I have an existing ASP.NET 3.5 application and I have a Silverlight 2 application that I want to use in that existing ASP.NET site.  The test page that was created when I made the silverlight project works fine, however when I put the div and asp:Silverlight tag into another page on my site it stops working.  I do not get any errors, the silverlight app just never loads up.  My site uses master pages and the master page has my ScriptManager object so there is no script manager in the same aspx file as the Silverlight control, however I did try putting a ScriptManagerProxy on the page and that did not help, I also tried removing the script manager from the master page and putting it in the ASPX along with the asp:Silverlight control, but still no success.

How can I get my silverlight application to load in my existing site that uses master pages?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

This isn't a solution - I'm having the same problem. I do get IE javascript errors via the little hazard icon in the lower left corner of IE7 when I try to run my aspx page with a masterpage and a Silverlight object. Do you get javascript errors as well?
Error: 'Sys.WebForms.PageRequestManager' is null or not an object
Error: 'Sys.UI.Silverlight' is null or not an object
Error: 'Sys.Application' is null or not an object
Error: 'Sys.UI.DomEvent' is null or not an object

These errors lead me to believe that the correct libraries are not being loaded by the client. This same aspx page and Silverlight app run fine if I use the aspx page as a stand-alone page (i.e. no MasterPage).

I think that you may be having a very different problem than I. I tried building a simple test application with a Silverlight app embedded in a content page. When I ran it, I got no errors and the Silverlight app was not visible.

After digging around, I found that by not using height and width = '100%' in the asp:Silverlight control but using actual pixel measurments, the Silverlight app magically appeared.

Hope this helps you.


<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/TS.master" %>
<%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls" TagPrefix="asp" %>
<asp:content runat="server" ID="content1" ContentPlaceHolderID="ContentPlaceHolder1">
   <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
   <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/Test_Silverlight.xap" MinimumVersion="2.0.31005.0" Width="500px" Height="500px" />

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.