Silverlight WCF Cross Domain Question

I have a silverlight application (hosted on intranet.mydomain.net) and a WCF service on (webservices.mydomain.net)

Do I need a cross-site policy file? If so, what would it be like to only allow access from intranet.mydomain.net?

+5
source share
2 answers

Yes, you will need the clientaccesspolicy.xml file in the ROOT of your service domain (webservices.mydomain.net).

Silverlight - . , , . .

:

<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://intranet.mydomain.net"/>
      </allow-from>
      <grant-to>
        <resource path="/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>

intranet.mydomain.net.

Edit

: , WCF?/ServiceA/a.svc /ServiceB/b.svc, , ServiceA , ServiceB, ?

:

<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
  <cross-domain-access>
    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://*"/>
      </allow-from>
      <grant-to>
        <resource path="/ServiceA/" include-subpaths="true"/>
      </grant-to>
    </policy>

    <policy>
      <allow-from http-request-headers="*">
        <domain uri="http://intranet.mydomain.net"/>
      </allow-from>
      <grant-to>
        <resource path="/ServiceB/" include-subpaths="true"/>
      </grant-to>
    </policy>
  </cross-domain-access>
</access-policy>
+4

All Articles