Embed silverlight page into Asp.net page

By default, when you new a silverlight application project, and host it in the default website. The project will automatically gernerate a “.aspx”and a“.html”files.

Look into the “.aspx”file:

<body>
    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/SilverlightApplication1.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="white" />
          <param name="minRuntimeVersion" value="4.0.50826.0" />
          <param name="autoUpgrade" value="true" />
          <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50826.0" style="text-decoration:none">
               <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </a>
        </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>

So silverlight can be pluged into .aspx by inserting it into <object/> tag.

When I try this by adding the object tag into a View, I got problem:

1. When debug or published, we can not see the silverlight UI;

2. I try modify the Path of .xap file ref, to ="http://www.cnblogs.com/ClientBin/SilverlightApplication1.xap". It works when debug, but still not get the UI when published.

3. Why!!!!!

4. For further trying, when I insert the silverlight object with “ClientBin/SilverlightApplication1.xap” into an index page, it works when debug and published.

5. when I insert the object with “http://www.cnblogs.com/ClientBin/SilverlightApplication1.xap” into other level pages, it only works when debug.

6. Why!!!

posted on 2011-05-08 14:38  Cooldash  阅读(297)  评论(0)    收藏  举报

导航