• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 586
  • Last Modified:

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?

  • 2
1 Solution
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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now