多应用Session共享时使用Flash上传在火狐中Session丢失问题

目前在使用Flash控件做上传文件功能时遇到一个问题。
FireFox中使用Flash上传文件时Session信息丢失。
由于在Flash中使用了FileReference上传文件时Session丢失

Adobe文档如此解释
The FileReference and FileReferenceList classes also do not providemethods for authentication. With servers that require authentication,you can download files with the Flash® Player browserplug-in, but uploading (on all players) and downloading (on thestand-alone or external player) fails. Listen for FileReference eventsto determine whether operations complete successfully and to handleerrors.


解决方法
1. 不使用FileReference,而使用form post上传文件。这样和普通的Html页面一样了。
2. 将Session id传到服务器。 如果你使用的Server是TomCat/JSP 可以如下添加SessionID. var request:URLRequest = new URL Request("http://www.[your url].com" ";jsessionid=" _yoursessionid); 3. 不验证Session,而检查上传ID。比如每次上传前,服务器生成一个ID,上传的时候把这个传ID作为URLRequest的参数传过去。
4. 将需要验证的用户名密码,添加至URLRequest的参数,在服务器端进行验证,然后在服务器端,将用户信息存入session,这样,只要flex页面session不变,下次提交请求时,服务器端的session就是保存用户信息的session。
5. 等待adobe发布hotfix.


目前文件我采用的是添加jsessionid的方式解决。

参考目录:
http://blog.sina.com.cn/s/blog_4b25b7d50100lhfg.html

猜你喜欢

转载自kzone.iteye.com/blog/1934784