当我尝试向用户展示"打开/保存"打开或保存Excel文件的拼图框,IE显示后,我按以下顺序收到错误"你想打开或保存blahblah.xls吗?"
当我点击打开或保存时,我得到" blahblah.xls无法下载"重试和取消按钮。我点击重试,它打开Excel并显示"您尝试打开的文件,' blahblah.xls',格式与文件扩展名指定的格式不同。验证文件是否已损坏,并且....是否要立即打开文件?"
如果我选择"是",我得到一些关于丢失文件的错误,所有这些.css文件,然后它尝试显示我在Excel中的aspx页面(全部损坏由于缺少CSS文件而导致版本化。)
我到处搜索,无法找到解决方案:
未经检查"不要将加密的页面提供给磁盘"在IE Internet选项/高级
中enter code here
Response.ClearContent();
Response.Clear();
Response.Buffer = true;
Response.Cache. SetCacheability(HttpCacheability.Public);
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + file + "-" + DateTime.Now.ToShortDateString() + ".xls;");
// response.Charset = "UTF-8";
Response.TransmitFile(FilePath);
Response.Flush();
HttpContext.Current.ApplicationInstance.CompleteRequest();
Response.End();`enter code here`