views:

2327

answers:

1

I have created a crosdomain policy file, I have added code to my flex app, and I still get security sandbox violation...have I done something wrong? Here are my errors and file snippets:

Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://mysite.com/folder1/folder2/media/swf_demo.swf cannot load data from http://mysite.com/folder1/folder2/media/locXML.xml.

swf_demo.swf is my flex application

The following lines have been added to my flex application:

Security.allowDomain("mysite.com");
Security.allowDomain("www.mysite.com");
Security.allowDomain("http://mysite.com/folder1/folder2/media/locXML.xml");

During my init() function, my first line reads:

Security.loadPolicyFile("http://mysite.com/crossdomain.xml");

Here is my crossdomain.xml:

<?xml version="1.0" encoding="utf-8"?>
<cross-domain-policy>
<allow-access-from domain="www.mysite.com" secure="false"/>
</cross-domain-policy>

why is it throwing this error? I have to be doing something wrong...

+1  A: 

www.mysite.com and mysite.com are different sites when it comes to crossdomain security. If your SWF is on the same site as your data then your don't need a crossdomain.xml policy. I would recommend redirecting users from mysite.com to www.mysite.com so that then everything would come from the same site and no policy file would be needed.

James Ward
James I actually do have a redirect on my site right now. When you type mysite.com it redirects you to mysite.com/folder1/demo/demo.htm could this have something to do with it?
Phil
In the error message above are the domain names accurate? A SWF loaded from mysite.com should always be able to access data on mysite.com without any crossdomain policy files.Also, you should remove the Security.allowDomain lines from your app. They don't do anything in this context and could open you to security vulnerabilities.
James Ward