标签:
// Add Excel as content type and attachment
Response.ContentType = “application/vnd.ms-excel”;
Response.AddHeader(“Content-Disposition”, “attachment; filename=” + binTarget);
mStream.Position = 0;
mStream.WriteTo(Response.OutputStream);
Response.Flush();
// BAD PATTERN: DO NOT USE.
// See http://blogs.msdn.com/b/aspnetue/archive/2010/05/25/response-end-response-close-and-how-customer-feedback-helps-us-improve-msdn-documentation.aspx
Response.Close();
IE10以上会严格校验Content-Length和Transfer-Encoding,如果武断使用 Response.Close();会导致直接切断,浏览器到服务器端的套接字连接,会产生数据到丢失,而导致实际传输长度和指定不一致,clicks Retry后IE将不在严格校验,所以重试之后正常下载,低端到IE版本没有严格校验到问题如:IE8。所以将Response.Close();该为Response.End();问题迎刃而解!!!
标签:
原文地址:http://www.cnblogs.com/zzq-include/p/5336913.html