如何从AIR应用程序打开并保持会话?

时间:2012-11-30 09:49:18

标签: actionscript-3 flex air flex4.6

  • 如何从AIR应用程序打开并保持与特定Web服务器的会话?

到目前为止,我试过这种方式,但没有运气:

var qHeader    : URLRequestHeader = new URLRequestHeader();


            var urlRequest : URLRequest  = new URLRequest( requestTarget.text );                    
                urlRequest.method        = URLRequestMethod.POST;   
                urlRequest.data          = cookiesObject;
                //urlRequest.requestHeaders.push( qHeader );
                urlRequest.requestHeaders = new Array( "Cookie: ASP.NET_SessionId=u43mjnpuerdicmu5pjobi2dz" )

            var rr : Response = new Response();

            //URLRequestDefaults.manageCookies = true;

            var _urlLoader : URLLoader = new URLLoader();
                _urlLoader.dataFormat  = URLLoaderDataFormat.BINARY;



                _urlLoader.addEventListener( Event.COMPLETE, onReceive );
                _urlLoader.addEventListener( IOErrorEvent.IO_ERROR, onFail );

            _urlLoader.load( urlRequest );          

1 个答案:

答案 0 :(得分:1)

每个请求标头必须是URLRequestHeader对象。试试这个:

urlRequest.requestHeaders = new Array(new URLRequestHeader("Cookie", "ASP.NET_SessionId=u43mjnpuerdicmu5pjobi2dz"));