Programming with .NET - Generalhttp://forums.silverlight.net//17.aspx/1?Programming+with+NET+GeneralGeneral discussions around authoring Silverlight .NET applications.Mon, 01 Jan 0001 00:00:00 -05001762275http://forums.silverlight.net//p/18490/62275.aspx/1?Difference+between+clientaccesspolicy+xml+and+crossdomain+xmlDifference between clientaccesspolicy.xml and crossdomain.xml <p>Hi,</p> <p>Just want to know what is the difference between clientaccesspolicy.xml and crossdomain.xml files in Silverlight Application. Are both files&nbsp;needed in the root of the domain where the service is hosted to configure the service to allow cross-domain-access. </p> <p>regards,</p> <p>Parimal<br> </p> 2008-06-18T03:30:17-04:0062280http://forums.silverlight.net//p/18490/62280.aspx/1?Re+Difference+between+clientaccesspolicy+xml+and+crossdomain+xmlRe: Difference between clientaccesspolicy.xml and crossdomain.xml <p>Not both files are needed in the root of the domain, but I personally think clientaccesspolicy is better because it can also be used to set configuration for Sockets.</p> <p>Difference are stated in the Documentation in Beta 2</p> <p>Silverlight supports two types of security policy files:</p> <ul> <li> <p>Flash policy file - the existing crossdomain.xml policy file used by Adobe Flash. This policy file can only be used by the <span><strong>WebClient</strong></span> and HTTP classes in the <span><strong>System.Net</strong></span> namespace. A Flash policy file must allow access to all domains to be used by the Silverlight 2 runtime.</p> </li><li> <p>Silverlight policy file - the Silverlight policy file that can be used by the <span> <strong>WebClient</strong></span> and HTTP classes in the<strong> <span>System.Net</span></strong> namespace and also by the sockets classes in the <span><strong>System.Net.Sockets</strong></span> namespace. This policy file has a different format than the Flash policy file.</p> </li></ul> <p>All in all, Silverlight policy can be used by all kinds of Connection between Client and Server.</p> <p>Refer to your question, if you only put one of them onto the root, cross-domain-access is also allowed, but for crossdomain.xml CrossDomain for Sockets doesn't allow.</p> 2008-06-18T03:42:14-04:00181454http://forums.silverlight.net//p/18490/181454.aspx/1?Re+Difference+between+clientaccesspolicy+xml+and+crossdomain+xmlRe: Difference between clientaccesspolicy.xml and crossdomain.xml <p>&nbsp;I've just wrestled with the cross domain beast all weekend, I don't think I necessarily won, I'm battered and bruised but managed to post my learnings from the struggle <a href="http://wallism.wordpress.com/2009/03/01/silverlight-communication-exception/" target="_blank"> here</a>.</p> <p>But in a nutshell, you don't need either if you host your SL app with your WCF service. If you want to go cross domain then my experience is that clientaccesspolicy.xml doesn't work, at least not with my setup (WCF service hosted in a console app). You must not have a clientaccesspolicy.xml and you must have a crossdomain.xml file that looks something like this: <br> </p> <pre class="prettyprint">&lt;<span class="tag">!DOCTYPE</span> cross-domain-policy SYSTEM “http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd”&gt;<br>&lt;<span class="tag">cross-domain-policy</span>&gt;<br>&lt;<span class="tag">allow-access-from</span> domain=”*” /&gt;<br><b>&lt;<span class="tag">allow-http-request-headers-from</span> domain=”*” headers=”SOAPAction” /&gt;<br></b>&lt;/<span class="tag">cross-domain-policy</span>&gt;</pre>&nbsp;<br> Note the second last line, it's different to what MSDN suggests you use. This works what MSDN has does not work.<span style="color:rgb(192,192,192)"></span><br> <br> Just a note, watching a http sniffer I could see my SL app requesting the clientaccesspolicy.xml file and it was successfully returned by my service...but still the cross domain exception occurred.<br> 2009-03-02T08:00:32-05:00500907http://forums.silverlight.net//p/18490/500907.aspx/1?Re+Difference+between+clientaccesspolicy+xml+and+crossdomain+xmlRe: Difference between clientaccesspolicy.xml and crossdomain.xml <p>Firstly, these files are refered by server only when there is request from different domain to check if the application making the request has sufficient rights to access the service.</p> <p><strong>Crossdomain.xml File:</strong><br> This file is defined by Adobe Flash. It can be used if you want your service to grant access to both Adobe and Silverlight application. </p> <p><strong>ClientAccessPolicy.xml file:</strong><br> This file is defined by Silverlight. It can be used only granting access to Silverlight applications., however this file provides more granular control over allowed domains.</p> <p>Whenever there is request from Silverlight application, first the clientaccesspolicy file is checked. If not present crossdomain file is refered to check the permission.</p> <p>More details can be found in 'Introducing Silverlight 4' by Ashish Ghoda.</p> <p>Thanks<br> Abhilash</p> <hr> <p>Please remember to mark the replies as answers if they help and unmark them if they provide no help. <br> </p> 2010-12-08T09:05:10-05:00