09
Sep
08

When to use Security.loadPolicyFile(url:String) in your Flex app

Often is the case where you’ll need to test your application on multiple boxes and for multiple clients, so you can’t just assume the crossdomain.xml file exists at the root of the domain or even in the same location…this forces you to pass in the crossdomain file’s location at run-time and then load it into the Flash Player before you make your first request for data / et al, and so I often wondered when the best time was to do this to ensure the file was loaded and thus eliminate any possible race conditions.

After searching around on the Flex 3 docs, I read that the best place for this call was in the root Application class’s preinitialize event handler — oddly enough I found this tidbit in the “Loading modules from different servers” section of the docs, but I also ran into this very race condition just recently in a web services based application as well.

Advertisements

59 Responses to “When to use Security.loadPolicyFile(url:String) in your Flex app”


  1. 1 Aryan
    October 26, 2008 at 2:11 pm

    Nice blog dude. helped me a lot in learning flex.
    I’ve had this problem for about 2 months now, and still not fixed. It’s related to this post
    can you see if u know the solution? apreciate ur help in advance
    Server is working fine because it’s been tested with a C# client

    Flex ==> Socket?!?!?!?
    Flex client connects to my server. (Event.CONNECT fires)
    It’s able to send messages to server
    It DOESN’T receive any message. (DataEvent.DATA won’t fire)
    policy running on IIS (localhost)

    the project is on my desktop not on IIS.

    Security.allowDomain(“*”);
    Security.loadPolicyFile(“http://localhost/crossdomain.xml”);
    socket = new XMLSocket(“10.0.0.3” , 8000);
    socket.addEventListener(DataEvent.DATA , OnData);
    socket.addEventListener(Event.CONNECT , onConnect);
    socket.addEventListener(IOErrorEvent.IO_ERROR, OnError);
    socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, OnSecurity);
    socket.addEventListener(Event.CLOSE, onDisconnect);
    socket.connect(“10.0.0.3” , 8000);

    both server and client are on the same machine.
    server is on desktop 2.
    there is no security error

    ANY IDEA WHY I AM NOT ABLE TO RECEIVE DATA THROUGH SOCKET?

  2. 2 tanvir
    April 20, 2009 at 6:47 am

    Hey Aryan,
    Did you solved your problem yet ????

    i am also facing this sort of problem …..

    if you solved that plz share the solution here.

    If anyone else have any solution or suggestion regarding the aryan problem plz provide it here.

  3. 3 Alina
    April 29, 2009 at 1:53 pm

    socket.addEventListener(ProgressEvent.SOCKET_DATA, socket_data_handler);

    Different event

  4. July 31, 2009 at 10:01 am

    Hi guys,

    About sockets, Flex must read the crossdomain from your socket (so with a different port than classic HTTP)…

    From your socket server, you need to detect the first connection and send the crossdomain.xml content, than Flex reconnect to the server and its fine!

  5. November 6, 2009 at 1:57 pm

    Anyone know if it’s possible to get cross domain content using LoadXML?

  6. 6 Suman
    January 20, 2010 at 11:46 pm

    Hi ,
    Any idea how to resolve this issue . How do I load policy file from the server . I have only port 80 open in server and I am not able to open any other port . Can I download the policy file using http or it has to be downloaded using xmlsocket protocol .

    regards
    Suman

  7. January 25, 2012 at 9:16 am

    Aryan, you need to download security policy from XmlSocket like this:

    Security.loadPolicyFile(“xmlsocket://10.0.0.3:10000”);

    Flash Player or AIR transmits , terminated by a null byte. Your server should respond by sending policy file (content of your crossdomain.xml file)

  8. January 25, 2012 at 9:17 am

    omg, tag stripped:

    * transmits <policy-file-request />

  9. April 3, 2012 at 7:06 pm

    Muhasebe kursları istanbul.

  10. June 7, 2012 at 6:47 pm

    I enjoy your wp layout, where did you get a hold of it?

  11. June 21, 2012 at 3:19 pm

    It seems to me that this web site doesnt load up in a Motorola Droid. Are other folks getting the exact same problem? I like this website and dont want to have to miss it any time Im away from my computer.

  12. June 22, 2012 at 9:14 pm

    Jesus Christ there is a lot of spammy comments on this webpage. Have you ever before believed about trying to get rid of them or installing a plugin?

  13. 15 account
    June 23, 2012 at 5:44 pm

    Hi, I just hopped over to your webpage using StumbleUpon. Not somthing I would typically read, but I liked your thoughts none the less. Thanks for creating some thing worth reading.

  14. June 25, 2012 at 2:47 am

    Nice post . Thanks for, writing on my blog page mate! I shall message you again. I didnt know that.

  15. June 25, 2012 at 2:52 am

    Mate! This site is awesome! How did you make it look like this !?

  16. June 25, 2012 at 9:00 pm

    Have you considered adding several social bookmarking buttons to these blogs. At least for facebook.

  17. 19 buy leather wallets
    June 26, 2012 at 4:25 pm

    Have you given any kind of thought at all with converting your main website in to Spanish? I know a small number of translaters here that would help you do it for free if you wanna contact me personally.

  18. June 27, 2012 at 2:31 am

    This blog site has some very helpful info on it. Cheers for informing me.

  19. June 28, 2012 at 7:25 pm

    fairly useful material, on the whole I picture this is worthy of a book mark, cheers

  20. June 30, 2012 at 2:37 pm

    Awesome post ! Thank you for, commenting on my blog man. Ill message you soon! I didnt realise that.

  21. July 4, 2012 at 2:55 am

    Strange , this post turns up with a black hue to it, what color is the primary color on your web site?

  22. July 4, 2012 at 9:19 pm

    When I originally left a comment I clicked the Notify me whenever new comments are added checkbox and currently each and every time a comment is added I receive four emails with the identical comment.

  23. July 5, 2012 at 5:33 pm

    I have got one recommendation for your website. It seems like there are a number of cascading stylesheet issues when launching a number of web pages within google chrome and firefox. It is operating alright in internet explorer. Possibly you can double check this.

  24. July 7, 2012 at 7:56 am

    Could you message me with any hints & tips about how you made your website look this cool , Id appreciate it.

  25. July 7, 2012 at 3:15 pm

    If you dont mind, exactly where do you host your weblog? I am looking for a great host and your webpage appears to be quick and up almost all the time

  26. July 7, 2012 at 9:17 pm

    I like the website layout . How do you make it. Its really good!

  27. July 7, 2012 at 9:59 pm

    Do youve got a spam problem on this internet site; I also am a blogger, and I was wondering your situation; weve developed some good strategies and we are looking to trade solutions with other individuals, be positive to fire me an e-mail if serious.

  28. July 8, 2012 at 9:00 pm

    Have you thought about adding some relevant links to the article? I think it will really enhance viewers understanding.

  29. July 9, 2012 at 2:53 pm

    Whenever I initially left a comment I clicked the Notify me any time new comments are added checkbox and currently each and every time a remark is added I get 4 messages with the identical comment.

  30. July 9, 2012 at 8:54 pm

    Wanted to drop a remark and let you know your Rss feed isnt working today. I tried adding it to my Google reader account but got nothing.

  31. July 9, 2012 at 11:06 pm

    Could you email me with any hints & tips on how you made your blog site look this cool , I would appreciate it!

  32. July 11, 2012 at 11:33 am

    I Will have to visit again whenever my course load lets up – however I am getting your Feed so i could go through your internet site offline. Thanks.

  33. July 11, 2012 at 11:48 pm

    While I truly like this publish, I believe there was an spelling error shut towards the finish with the third sentence.

  34. July 12, 2012 at 3:37 am

    Jesus Christ theres lots of spammy feedback on this web site. Have you actually thought about attempting to get rid of them or installing a wordpress plugin?

  35. July 12, 2012 at 10:07 am

    Cool post ! Thanks for, writing on my blog page mate. I shall email you again! I did not know that.

  36. July 12, 2012 at 2:56 pm

    Wanted to drop a remark and let you know your Feed is not working today. I tried including it to my Yahoo reader account but got absolutely nothing.

  37. July 14, 2012 at 1:33 am

    Although I actually like this post, I believe there was an punctuational error near towards the end of the third section.

  38. July 14, 2012 at 8:22 am

    Is it alright to place a portion of this on my webpage if I post a reference point to this web-site?

  39. July 14, 2012 at 8:24 am

    A insightful post right there mate ! Cheers for the post .

  40. July 14, 2012 at 9:22 pm

    Awesome post . Thank you for, writing on my blog page man. I will message you some time. I didnt know that!

  41. July 15, 2012 at 5:58 am

    Is it alright to put part of this in my personal website if I publish a reference to this website?

  42. July 15, 2012 at 2:22 pm

    Do you might have a spam concern on this web site; I also am a blogger, and I was asking yourself your scenario; we now have created some great methods and we are looking to trade solutions with other people, be positive to blast me an e-mail if interested.

  43. July 15, 2012 at 9:22 pm

    This is often a excellent web site, could you be interested in working on an interview about just how you created it? If so e-mail me and my friends!

  44. July 16, 2012 at 10:23 pm

    This is a fantastic web site, would you be interested in going through an interview about just how you made it? If so e-mail me and my friends!

  45. December 9, 2012 at 8:06 pm

    Wow, that’s what I was exploring for, what a material! present here at this weblog, thanks admin of this web page.

  46. April 16, 2013 at 2:42 pm

    Not a problem, Frank glad you’re enjoying all of them!

  47. July 11, 2013 at 10:04 am

    I do not even know the way I stopped up right here, but I
    believed this post was great. I don’t recognise who you are but certainly you’re going to a
    well-known blogger when you are not already. Cheers!

  48. October 18, 2013 at 11:34 am

    Excellent blog you have here.. It’s difficult to find quality
    writing like yours these days. I seriously appreciate individuals like you!

    Take care!!

  49. June 13, 2014 at 10:47 am

    I pay a visit day-to-day a few web sites and information sites to read posts, but this weblog provides
    quality based content.

  50. June 20, 2014 at 10:15 pm

    When someone writes an paragraph he/she keeps the thought of a user in his/her brain that
    how a user can know it. Thus that’s why this article is amazing.
    Thanks!

  51. June 30, 2014 at 12:36 am

    Hey There. I found your blog using msn. This
    is a very well written article. I will be sure to bookmark it and come back to read more of
    your useful information. Thanks for the post.
    I will certainly return.

  52. July 3, 2014 at 9:27 am

    Great article! We are linking to this great post on our website.
    Keep up the great writing.

  53. August 9, 2014 at 6:30 am

    Hi mates, nice post and nice urging commented
    at this place, I am truly enjoying by these.

  54. August 29, 2014 at 5:51 am

    Hey I know this is off topic but I was wondering if you knew
    of any widgets I could add to my blog that automatically tweet my
    newest twitter updates. I’ve been looking for a plug-in like this for quite some time and was hoping maybe you
    would have some experience with something like this. Please let me know if you run into
    anything. I truly enjoy reading your blog and I look forward to your
    new updates.

  55. August 30, 2014 at 10:49 pm

    Nice blog here! Also your site loads up very fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my website loaded up as fast as yours lol

  56. April 8, 2016 at 10:31 am

    Thx; Scorgie is a H&S vet, he did the Ordination of Women debate and had a great time. I’ll have BTall reach out… Click https://twitter.com/moooker1


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: