views:

871

answers:

2

I am trying to figure out how to properly setup my crossdomain file. Here is what I have so far:

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
<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>

The flex app is configured to access a asp.net webservice at

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

When I navigate to:

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

the application loads and works just fine. However, when I navigate to:

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

the flex app fails to communicate with the webservice due to a sandbox security error. Any body know how I need to configure my crossdomain.xml file so that users do not have to remember to include "www" in the url?

Thank you for your help.

A: 

"*.contoso.com" should work. Did u try specifying it explicitly?

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

EDIT: why do u need a policy file here in the first place? Both are in the same domain, right? change the load url to a relative path.

Amarghosh
A: 

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.

James Ward
Thank you, this put me on the right trail. I was missing the "allow-http-request-headers-from" element (it was mentioned in the adobe article you linked to). This is working now.
Daveed