views:

37

answers:

1

hello, i'm trying to get xml file that requires HTTP Basic authentication :

private function authAndSend(service:HTTPService):void
            {
                var enc:Base64Encoder = new Base64Encoder();

                enc.insertNewLines=false;

                enc.encode("login:pass");

                service.headers["Authorization"] = "Basic " + enc.toString();

                service.headers["Accept"] = "application/xml";              

                service.contentType="application/x-www-form-urlencoded";
                service.method = HTTPRequestMessage.GET_METHOD;

                service.resultFormat = "xml";

                service.send();


            }

In AIR it works well. But in Flex(3.5,4.1) it raises pupup login window(standard web browser login form on basic http authentication). How to avoid this?

+1  A: 

HTTP headers, including Authorization, are blocked by default from being sent by the Flash Player. You need to specifically allow the Authorization header in your crossdomain.xml file.

http://www.adobe.com/devnet/flashplayer/articles/flash_player9_security_update.html

Cameron Yule