问题
i got a nice one.
All the days before yesterday when calling a URLRequest the session cookie in the browser got sent back to the server for authentication. Suddenly when issueing the URLRequest the session cookie is not sent any more by the browser. When i open the copy and pasted url from the URLRequest in a browser window it works fine.
Do you have any idea what the problem may be....??
Has it something to do with localhost?? maybe when sending a request from flash to localhost the session cookie is not sent back....but it wirked for weeks now...and i cant think of what i could have changed....very strange
Thanks for your help in advance Martin
回答1:
The code in Flash to load the http address is:
var request:URLRequest;
var vars:URLVariables = new URLVariables();
var urlLoader:URLLoader;
request = new URLRequest(url);
request.method = URLRequestMethod.GET;
urlLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, handleComplete);
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
try {
urlLoader.load(request);
} catch (error:Error) {
LogUtil.debug("Unable to load Payment Data." + error);
}
The back-end is coded in ruby and i make the following call:
puts "SESSION ID: #{session[:user_id]}"
回答2:
The short answer is that Flash doesn't have any knowledge of or control over whether the browser attaches cookies to HTTP requests. Flash just invokes the browser's network stack and gets a response back later; Flash doesn't do its own networking or deal with cookies per se. So my best bet would be perhaps a browser setting, something on the server side? No idea really, but I don't think AS3 will turn out to be involved.
来源:https://stackoverflow.com/questions/6669223/flash-player-and-browser-session-cookie-sending-issue