/**************************************************************************/
//Using crossdomain.xml
//
//Version 2.0
/*************************************************************************/
To access data from a different server than the one hosting your Flex application, the remote server needs to have a cross-domain file in the root directory. For security reasons, the Web browser cannot access data that resides outside the exact Web domain where the SWF file originated. However, Adobe Flash Player can load data across domains if permission is granted from the server. This is accomplished by including a small crossdomain.xml file on the remote server that permits Flash to connect to services on that server. For instance:
为了访问来不同服务器上的数据而不是放置你的Flex程序的服务器,远程服务器需要有一个Cross-domain.xml文件放置在根目录下面。基于安全的原因,web 浏览器不能访问存在于外部网域的数据,Swf文件就存放在这个外域中。尽管如此,Adobe Flash 播放器仍然能够跨域访问数据,只要在服务器中创建一个许可文件。这是通过在远程服务器上面放置一个小的crossdomain.xml文件,这个远程服务器允许flash 连接放置在服务器上面的服务。比如:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*"/>
</cross-domain-policy>
Deploying crossdomain.xml
To deploy the cross-domain file on ArcGIS Server, see the instructions specific to your platform and version.
- NET
Add crossdomain.xml to your Web server root directory, for example, C:\inetpub\wwwroot. - Java
Add crossdomain.xml to <ArcGIS_Server_Install_Location>\ArcGIS\java\manager\web_output for 10.0 or <ArcGIS_Server_Install_Location>\ArcGIS\java\web_output for 9.3 installations of ArcGIS Server. On Windows the default locations for these directories are:- 9.3 - C:\Program Files\ArcGIS\java\web_output
- 10.0 - C:\Program Files\ArcGIS\Server\java\manager\web_output
For additional information, read Using cross-domain policy files in the Adobe Flex 3 Help, see the Adobe TechNote "External data not accessible outside a Macromedia Flash movie's domain," or view a sample cross-domain file.
部署 crossdoman.xml文件
为了在ArcGIS Server 上面部署Cross-doman.xml文件,查看下面的针对你的平台和版本的介绍。
.NET 环境下
添加crossdomain.xml文件到一个web 服务器根目录,比如:C:\inetpub\wwwroot.
JAVA环境下
添加CrossDomain.xml文件到<ArcGIS_Server_Install_Location>\ArcGIS\java\manager\web_output for 10.0 或者<ArcGIS_Server_Install_Location>\ArcGIS\java\web_output ,安装ArcGIS SERVER 9.3的地方。 在windows 下,这些目录默认的位置是:
9.3 - C:\Program Files\ArcGIS\java\web_output
10.0 - C:\Program Files\ArcGIS\Server\java\manager\web_output