這是***令人難以置信!閃存程序員熟悉這個例子:基本認證與閃存
var req:URLRequest = new URLRequest("http://yoursite.com/yourservice.ext");
req.method = URLRequestMethod.POST;
req.data = new URLVariables("name=John+Doe");
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode("yourusername:yourpassword");
var credsHeader:URLRequestHeader = new URLRequestHeader("Authorization", "Basic " + encoder.toString());
req.requestHeaders.push(credsHeader);
var loader:URLLoader = new URLLoader();
loader.load(req);
好的......很好......真的很有效。正如你所看到的,我手動添加一個頭部授權基本HTTP認證。但是...如果我更改從POST到GET的請求metod,則不會生成標頭。
有沒有人知道解決方案? 1000x thx!
我發現這個:http://www.abdulqabiz.com/blog/archives/2006/03/03/http-authentication-for-httpget-requests-using-actionscript-3/ – xpepermint 2009-10-27 14:45:41