Hi all,

I have a Flex app which calls ASP pages on an application server.  
The application server is located on a different domain to the one 
hosting the swf so I am using a crossdomain file.  Everything works 
fine in Internet Explorer but refuses to work in Firefox.  Here is a 
simple app which demonstrates the problem:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; 
layout="absolute" applicationComplete="doTest();">
        <mx:Script>
                <![CDATA[
                        import mx.rpc.events.ResultEvent;
                        import mx.rpc.events.FaultEvent;
                        import mx.rpc.http.mxml.HTTPService;

                        private var connectIP:String 
= "nnn.nnn.nnn.nnn";
                        private var connectPort:int = 80;
                        private var myService:HTTPService;

                        public function doTest():void
                        {
                                var policyURL:String = "http://"; + 
connectIP + ":" + connectPort.toString() + "/crossdomain.xml";
                                logMsg("## Loading policy file from " 
+ policyURL);
                                Security.loadPolicyFile(policyURL);

                                var serviceURL:String = "http://"; + 
connectIP + ":" + connectPort.toString() + "/somePage.asp?t=" + (new 
Date().getTime());
                                logMsg("## Connecting to " + 
serviceURL);
                                myService = new HTTPService();
                                myService.addEventListener
(FaultEvent.FAULT, serviceFault);
                                myService.addEventListener
(ResultEvent.RESULT, serviceResult);
                                myService.url = serviceURL;
                                myService.method = "GET";
                                myService.send();
                        }

                        private function serviceFault
(e:FaultEvent):void
                        {
                                logMsg("## serviceFault: " + 
e.toString());
                        }

                        private function serviceResult
(e:ResultEvent):void
                        {
                                logMsg("## serviceResult: " + 
e.toString());
                        }

                        private function logMsg(s:String):void
                        {
                                trace(s);
                                txtOutput.text += s + "\r\n";
                        }
                ]]>
        </mx:Script>
        <mx:TextArea id="txtOutput" width="100%" height="100%" 
editable="false"/>      
</mx:Application>

(you will need to set connectIP and connectPort at the top - I do not 
have anywhere to host this app publicly).

The app manually loads a crossdomain policy file because the 
application server may not necessarily be listening on port 80.  When 
I run this app in Internet Explorer, I can see from a network trace 
that it requests and receives the crossdomain file then makes the 
call to somePage.asp.  However, when I run it in Firefox the 
crossdomain file is retrieved but the request for somePage.asp never 
goes out.  It looks like the Flash player blocks the request because 
it doesn't think it has been authorised?

Does anybody have any ideas why this app works in IE but not in 
Firefox?  The same app works if it connects to a server in the same 
domain as the SWF so its got to be something to do with the 
crossdomain policy request.

I am using Firefox 2.0.0.7 and Flash player plugin 9,0,60,120.

Many thanks,

Nick.


Reply via email to