原因:由於jquery uploadify是借助flash來實現上傳的,每一次向后台發送數據流請求時,ie會自動把本地cookie存儲捆綁在一起發送給服務器。但FF、chrome不會這樣做,他們會認為這樣不安全。所以在你需要登錄驗證后的頁面進行上傳文件時,FF和chrome獲取沒有把本地cookie傳上去,導致上傳失敗。
解決辦法:在發起頁面請求時,驗證cookie之前,重新設置cookie,既可正常上傳文件
.NET解決方案:在Global.asax文件中加入Application_BeginRequest
protected void Application_BeginRequest() { if (HttpContext.Current.Request.QueryString["OpType"] != null) { string c_name = "mycookie"; HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(c_name); if (cookie == null) { cookie = new HttpCookie(c_name); } if (cookie.Value == null) { cookie.Value = HttpContext.Current.Request.QueryString["setcookie"]; HttpContext.Current.Request.Cookies.Set(cookie); } } }