我使用uploadify 3.0.0上传文件。此uploadify使用swf发送ajax请求。经过研究,我发现当通过swf发送请求时,服务器中会打开新的会话。因此,我在会话中存储的所有数据都变得无法访问(因为创建了新会话)。
我如何使用 uploadify ,以便**不会更改服务器中的当前会话?
CLIENT_SIDE
$('#upload').uploadify({
swf: '/Scripts/jqUploadify-3.0.0/uploadify.swf',
uploader: '/FileUpload/UploadLogo',
cancelImage: '/Scripts/jqUploadify-3.0.0/uploadify-cancel.png',
auto: true
});
SERVER_SIDE
[HttpPost]
public JsonResult UploadLogo()
{
if (Request.Files.Count > 0)
{
//Session["PATH"] is NULL, because the session is changed because of SWF
var path = Session["PATH"] as string;
}
return Json(new { });
}
谢谢
答案 0 :(得分:2)
通常,您必须将会话ID作为参数传递给uploadify,或者使用cookie抓取器将cookie从浏览器中拉出到SWF中。请参阅Uploadify (Session and authentication) with ASP.NET MVC了解您可能需要的内容。