HTTPS文件下载出现问题 在针对流的下载时出现的问题描述: 一段JAVA文件下载代码如下: string strFileName=""; strFileName=dtsDoc.Tables[0].Rows[0]["cFileName"].ToString(); Response.Clear(); //Response.ContentType = "application/octet-stream"; Response.ContentType = dtsDoc.Tables[0].Rows[0]["cTypeName"].ToString(); Response.AddHeader("Content-Disposition", "attachment; filename= "+ HttpUtility.UrlEncode(strFileName, System.Text.Encoding.UTF8)); byte[] bFile = (byte[])dtsDoc.Tables[0].Rows[0]["gAddition"]; Response.OutputStream.Write(bFile,0,bFile.Length); //Response.BinaryWrite(bFile); Response.Flush(); 此代码在Http协议下运行正常,可以下载文件。 但是放入Https协议下就不好用 一选择保存,IE便提示:IE无法下载,请求站点不可用或找不到 解决办法:只要把清除缓存的代码去掉就行。 (经过中电投ERP 公司代码验证验证) SSL客户端下载文件,https下载文件需要注意的事情: 1、完成下载文件程序在http下测试通过,而 https下总是报页面错误。 2、主要跟response中的header有关。 设置添加了response.addHeader("Pragma", "public"); response.addHeader("Cache-Control", "max-age=0") 微软讲跟防火墙有关,有的防火墙会自动修改header中 cache-control信息 3、客户端:控制面板->添加或删除程序-〉添加删除windows组件-〉Internet Explorer增强的安全配置,把它去掉,就会解决很多IE的问题。 4、微软网站说明: 现象: (1) 在 IE6/7下,使用HTTPS下载/打开文件时,通过抓包发现文件已传输,但IE提示“Internet Explorer无法下载 *** (来自 ***)。 Internet Explorer无法打开该Internet站点。请求的站点不可用,或找不到。请以后再试。” ("Unable to download. Internet Explorer was unable to open this site. The requested site is either unavailable or cannot be found. Please try again later."),下载失败。 (2) 如果下载目标有一个hyperlink, 当右键选择“目标另存为...”时,提示 “Internet Explorer无法下载 *** (来自 ***)。无法将文件写入高速缓存”( "The file could not be written to the cache"),下载失败。 解决方法: (1) 参考上述MS KB,向 client注册表增加下列DWO...