Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by gabs · Dec 14, 2012 at 07:49 PM · wwwwwwformcrossdomain

"SecurityException: No valid crossdomain" even though the webplayer didn't even try to get the crossdomain policy request.

I did all the necessary steps:
1 - I have a game hosted on server1;
2 - The highscores services are on server2;
3 - I setup a python policy request server on port 843;
4 - I tested the server through telnet. It works as expected;
5 - Just in case, there is a crossdomain.xml on server2.com/crossdomain.xml. It was uploaded as ASCII;
6 - The game starts, it runs this first, just in case: Security.PrefetchSocketPolicy("server-2-ip", 843); I can see that it works by looking at the packets through Wireshark;
7 - I send a WWW get request to see if it works: WWW wc = new WWW("http://server2.com/crossdomain.xml"); yield return wc; Debug.Log(wc.text); It does.

HOWEVER, when I try to send a WWWForm, the Player outputs this to the log:

 SecurityException: No valid crossdomain policy available to allow access
   at (wrapper managed-to-native) UnityEngine.WWW:get_bytes ()
   at UnityEngine.WWW.get_text () [0x00000] in <filename unknown>:0 
   at ScoreManager+<GetScoresByIp>c__IteratorD.MoveNext () [0x00000] in <filename unknown>:0 

Then I look at the packets sent. It didn't send any! What the hell. It didn't even check for a cross domain policy file anywhere. I looked everywhere to see if I was doing something wrong. But everything seems fine.

This is how I send (well, it actually never sends to any server at all) the post data:

 WWWForm data = new WWWForm();
 data.AddField("key", this.c);
 var ip = "0.0.0.0";
 var jdata = string.Format("{{ \"action\" : \"post_score\", \"ip\" : \"{0}\", \"scoredata\" : {{ \"name\" : \"{1}\", \"score\" : {2}, \"userdata\" : \"{3}\" }} }}", ip, name, score, userdata);
 data.AddField("json", EncryptString(jdata, this.a, this.b));
 WWW wc = new WWW("http://server2.com/post.php", data);
 yield return wc;
 JsonReader reader = new JsonReader();
 reader.Read(wc.text);
 JsonElement elmt = reader.Content;

Is there anything wrong with this? Is this a bug?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gabs · Dec 15, 2012 at 01:59 AM 0
Share

Btw it's on the latest Unity 3.5 version.

avatar image SantaKlaus · Nov 08, 2013 at 10:26 PM 0
Share

I got the same error with Unity 4.2.1.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Graham-Dunnett · Nov 08, 2013 at 10:51 PM

You are mixing up the crossdomain.xml and the socket policy file. If you are using sockets then you need a policy server running on port 843. If you are just using WWW/WWWForm then you only need the crossdomain.xml on the root of your web server. So, your (3), (4) and (6) are irrelevant most probably.

You say that you have fetched the crossdomain.xml from the server, and this gets delivered correctly. This confirms that the file has been read, and hence you should be able to read any file from the server. What I am somewhat suspicious about is whether the crossdomain.xml allows you to post data. Set ENABLE_CROSSDOMAIN_LOGGING to 1 and see what diagnostic information is written.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Getting info using WWW & PHP 3 Answers

How do I make a simple POST request to Amazon S3? 2 Answers

WWW/WWWForm, does Unity validate SSL certificates? 1 Answer

How to Upload multiple files to a server using UnityWebRequest.Post(); 3 Answers

Mixing domains, CORS and webgl problem 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges