0

我想弄清楚如何正确设置我的跨域文件。这是我到目前为止所拥有的:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all" />
    <allow-access-from domain="contoso.com"/>
    <allow-access-from domain="*.contoso.com"/>
</cross-domain-policy>

flex 应用程序被配置为访问 asp.net 网络服务

http://www.contoso.com/webservice.asmx

当我导航到:

`http://www.contoso.com/flexapp.html` 

应用程序加载并正常工作。但是,当我导航到:

`http://contoso.com/flexapp.html`

由于沙盒安全错误,flex 应用程序无法与 web 服务通信。任何人都知道我需要如何配置我的 crossdomain.xml 文件,以便用户不必记住在 url 中包含“www”?

感谢您的帮助。

4

2 回答 2

1

I usually setup a 301 (permanently moved) redirect for me non-www domain names that redirect to www. I think that is a pretty common practice. Another option is to use relative paths in your Flex app (although that's harder with WSDLs. If you must make the crossdomain request then you will also need to specify the master policy. Another alternative would be to put the web services on ws.contoso.com and have a crossdomain policy that allows requests from contoso.com and www.contoso.com.

于 2009-09-15T09:40:58.797 回答
0

"*.contoso.com"应该管用。您是否尝试明确指定它?

    <allow-access-from domain="www.contoso.com"/>

编辑:为什么你首先需要一个策略文件?两者都在同一个域中,对吗?将加载 url 更改为相对路径。

于 2009-09-15T07:09:15.813 回答