Reputation: 11017
I have silverlight4 application that makes a cross domain request to some other webserver, as forum stackoverflow posts and MSDN, silverlight has restriction making crossdomain requests. But I found out that in silverligh4 and later versions you do can add an exception via clientaccesspolicy.xml to make these requests. I added following xml as my clientaccesspolicy.xml
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
xml files stays at the root of my application. But at the following line i am still thrown the security exception
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
Can any one shed some light what i might be missing here. I know there it is possible to host another local service in the application and make requests via that. But I would not want to go that solution.
Upvotes: 1
Views: 183
Reputation: 5650
I'm guessing SL is not reading the XML for some reason.
I'd recommend you start up Fiddler and check the requests made by Silverlight and their responses. It SHOULD look for the XML file when accessing data from a different domain. If it gets a 404 (or other errors) it'll throw a security exception.
Also... just to make sure... you didn't forget about <?xml version="1.0" encoding="utf-8"?>
at the start, I hope? And you do remember that the XML file must be on the server the Silverlight application will access, NOT the server hosting the Silverlight aplication, right? ;)
Upvotes: 1