views:

612

answers:

1

I'm trying to upgrade a project that uses Silverlight 2 to use Silverlight 4 but I have problem with initparam to set domain.

The old Silverlight 2 project:

 <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="~/ClientBin/EKAKC.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />
        </div>
          </form>

And from Default.aspx.cs: Xaml1.InitParameters += "Domain=" + domain;

The new Silverlight 4 project:

<body style="height: 100%; margin: 0;">
    <form id="form1" runat="server" style="height: 100%;">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <div id="silverlightControlHost">
        <object  type="application/x-silverlight-2" data="data:application/x-silverlight,"
            width="300" height="300">
            <param name="source" value="EKAKC.xap"/>
            <param name="initParams" value="<%= string.Format("WCFReferenceURL={0}", ConfigurationManager.AppSettings["WCFReferenceURL"])%>" />
            </object>
    </div>

The Domain will not be set in my new Silverlight 4 project

A: 

It may be necessary to encode the value:-

       <param name="initParams" value="<%= "WCFReferenceURL=" + Server.HTMLEncode(ConfigurationManager.AppSettings["WCFReferenceURL"])%>" /> 
AnthonyWJones