Today, when I used flex to call ASP. NET web services, I always jumped out of the "Security Error accessing URL" error. I checked the information and found out that the sandbox of the original flash was related.
The principle is that when the SWF file tries to access data in other domains, Flash Player automatically loads the policy file in that domain. If the domain where the SWF file is located is included in this policy file, data can be accessed; otherwise, data cannot be accessed. The following is the official Adobe article:
When a SWF file attempts to access data from another domain,Flash Player automatically attempts to load a policy file from that domain.If the domain of the SWF file that is attempting to access the data is stored in the policy file, the data is automatically accessible.
The problem I encountered is that the policy file is not available on IIS, and the solution is to add the policy file.
Solution:
Create an XML file named crossdomain. xml. If you do not need to worry about it, use this file name instead.
copy the following content to an XML file: XML version = "1.0" ?>
Cross-Domain-policy >
allow-access-from domain =" * " />
Cross-Domain-policy >
Save it to wwwroot. I tried to put it in the application.ProgramBut it does not work. You can put it under wwwroot. The above crossdomail. xml allows all SWF files to access the local host.
Then OK. For more details, see:
Http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm? Context?livedocs_book_parts&file=05b_security_176_04.html