Silverlight Cross Domain Policy

I have this little silverlight application which asynchronously reads xml files from another website, which is controlled by my self. When developing all was working as expected the files where being read in and everything looked and worked great.

But when i pushed these onto the production environment what did i get an error saying that i couldn’t actually read the files and i was getting a security exception.

I did some looking and finally found out that it’s actually Silverlight blocking me from reading the files. Why is it blocking me from reading the files but the more i read i finally got a better understanding of why it’s being blocked. It all has to do with cross domain, i had to start thinking not a simple developer but as a system can i have access to this etc.

Finally found the solution and all i had to do was add my “crossdomain.xml” file to the website and it all worked, below is an example of the xml file:

<?xml version=”1.0″?>
<!DOCTYPE cross-domain-policy SYSTEM “”&gt;
<allow-http-request-headers-from domain=”*” headers=”*”/>

Silverlight uses both it’s own “clientaccesspolicy.xml” and then falls back to the default “crossdomain.xml” file. I believe you should set it up to work with both silverlight and flash so using the crossdomain.xml file is recommened but this depends on your requirements.

This example just allows all requests to function. For more information you can read this very help full blog I found:

Hope this helps, later.