从服务器收到重复的标头
来自服务器的响应包含重复的标头.此问题通常是配置错误的网站或代理的结果.只有网站或代理管理员才能解决此问题.
错误349(net :: ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION):收到多个不同的Content-Disposition标头.不允许这样做以防止HTTP响应分裂攻击.
我在chrome中导出为pdf时发现了这个错误.
Response.Buffer = false;
Response.ClearHeaders();
string ext = objProp.PACKAGEFILENAME.Substring(objProp.PACKAGEFILENAME.LastIndexOf("."));
string ext1 = ext.Substring(1);
Response.ContentType = ext1;
Response.AddHeader("Content-Disposition", "target;_blank,attachment; filename=" + objProp.PACKAGEFILENAME);
const int ChunkSize = 1024;
byte[] binary = objProp.PACKAGEDOCUMENT;
System.IO.MemoryStream ms = new System.IO.MemoryStream(binary);
int SizeToWrite = ChunkSize;
for (int i = 0; i < binary.GetUpperBound(0) - 1; i = i + ChunkSize)
{
if (!Response.IsClientConnected) return;
if (i + ChunkSize >= binary.Length) SizeToWrite = binary.Length - i;
byte[] chunk = new byte[SizeToWrite];
ms.Read(chunk, …Run Code Online (Sandbox Code Playgroud)