- Home /
CrossDomain.xml issue
Hi, I'm in huge trouble ... I'm calling a service from my unity3D game, but it says no crossdomain.xml policy file found. for the time being I'm using LOCALHOST as http://localhost:3537/Service1.svc/search?q=newquery
and I've place crossdomain.xml
in the root folder of server i.e. I can get contents of that file by http://localhost:3537/crossdomain.xml
and file contains
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
and when I call the service I use InspectElement/Network
(in Chrome), here I can see request is send to http://localhost:3537/crossdomain.xml
and response is received i.e. contents of xml file but still it says after response "Rejected because no crossdomain.xml policy file found". I've search a lot but nothing is going to work. I've read Security Sandbox of the Webplayer but unable to find solution. I've added Host URL
in Edit/Project Setting/Editor
as http://localhost:3537
then it work fine in unity3D, but if I build it and run ... Same ERROR ... kindly help me, I've less time as I've to submit my Project. This is my code
WWW url = new WWW("http://localhost:3537/Service1.svc/search?q=newquery");
yield return url;
if(url.error == null)
{
str = "WWW Ok!: " + url.text;
}
else {
str = "WWW Error: " + url.error;
}
Answer by rutter · Jun 04, 2014 at 05:35 AM
You're missing an important line from the top of crossdomain.xml
:
<?xml version="1.0"?>
In addition, you should make sure that the file is encoded as an ASCII file. Some text editors will save it in another encoding by default.
I've that line but it isn't in my post by mistake. I've used visual studio to create xml ... I've also tried save as plain text in word ... how to save in ASCII ? any text editor ?
Thanks a lot .... finally I've overcome this issue, after a long struggle, by just saving the crossdomain.xml in ANSI (8 bits) encoding scheme which is similar to ASCII (7 bits), I've used notepad for this purpose.