Thursday, September 02, 2010

No need for server side clientaccesspolicy.xml when using Silverlight for Windows phone 7 Series

If you're a seasoned Silverlight developer you'll be well aware of having to incorporate the clientaccesspolicy.xml file in the root of your service domain with a method that returns the file as a Stream object. MSDN documentation that describes that and the documentation can be found here:

Then you would typically define a method that looks like the following that is accessible via a RESful call (if using WCF) - note: the UriTemplate here is what is important:
[OperationContract, WebGet(UriTemplate = "/clientaccesspolicy.xml")]
Stream GetClientAccessPolicy();
Executing any method from within a desktop Silverlight app whether in-browser or out-of-browser (SL 3 feature) will call that method above implicitly by the SL HTTP stack.

When calling any web method from a Windows phone Silverlight application, the 'GetClientAccessPolicy' is not called so there is (currently no need for it if your clients are from WP7 apps).

I'm not sure if this will change when the WP7 tools RTM on the 16th September - I will be the first to try!

My colleague Anthony Cooper found this out, so thanks to him.

No comments: