我已經繼承了一箇舊的應用程序,它將壓縮文件存儲在數據庫中,並且需要檢索該文件。在Firefox中工作正常,我可以打開zip文件,裏面的每個文件都很好。當我在IE7中運行它時,出現以下錯誤。寫出一個壓縮文件在IE7中不起作用
Internet Explorer無法從localhost下載ProductContentFormImage.aspx。
Internet Explorer無法打開此Internet站點。請求的網站不可用或無法找到。請稍後再試。
我使用下面的代碼。
byte[] content = (byte[])Session["contentBinary"];
Response.ClearContent();
Response.ClearHeaders();
Response.Clear();
Response.Buffer = true;
Response.Expires = 0;
Response.ContentType = "application/zip";
Response.AddHeader("Content-Length", content.Length.ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=content.zip");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.BinaryWrite(content);
Response.End();