- Home /
FTP connection WebPlayer SecurityException: Unable to connect, as no valid crossdomain policy was found
Hi, i am creating WebPlayer game where you can save and load based on your login/password. I need to connect to my Ftp server that is secured with login and password. crossdomain.xml is included in the root folder of my server.
webClient.Credentials = new NetworkCredential("username", "password");
string js = webClient.DownloadString("ftp://ftp.domain.com/saveData/saveData.json");
savingData = js;
I always got an SecurityException: Unable to connect, as no valid crossdomain policy was found. if i change the url to an classic webserver without any security with the same crossdomain.xml file it works fine. I was also trying FtpWebRequest methods with the same result.
Any ideas what can be wrong ? Thank you
Answer by Bunny83 · Mar 27, 2015 at 02:03 AM
An FTP connection is not a HTTP connection. Therefore i would say your FTP server needs to run a socket policy server on port 843 or on a different port and you have to call Security.PrefetchSocketPolicy manually. The crossdomain.xml file in the root folder of a webserver only grants access to that webserver. Any other ports / protocols aren't affected by this file. Read the linked page carefully.
@BDV:
Unity ships a simple console program (sockpol.exe) which can be run along with your server. It's located at your Unity install path:
Unity/Editor/Data/Tools/SocketPolicyServer/
You can simply run that program with the parameter "--all" and it should enable the webplayer to fetch a policy which allows access to all ports on that server.
sockpol.exe --all
Unity also ships the "sockpol.cs" file which contains the source code of that little program in case you want to implement your own.
Your answer
Follow this Question
Related Questions
Webplayer throwing FTP errors as popups 1 Answer
Web Player and database 1 Answer
Ive spent 3 hours on this x.X 7 Answers
Crossdomain.xml policy file not found 0 Answers
crossdomain.xml error when hosted on https but requesting http 2 Answers