2010-09-29 85 views
1

我試圖得到XML文件的基本身份驗證的問題,需要HTTP基本身份驗證:柔性HTTP

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(); 


      } 

在AIR它工作得很好。但是在Flex(3.5,4.1)中,它引發了pupup登錄窗口(基本http認證的標準web瀏覽器登錄表單)。如何避免這種情況?

回答