此代码将始终使我的 aspx 页面加载两次。这与 AutoEventWireup 无关。
Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "inline;filename=data.pdf");
Response.BufferOutput = true;
byte[] response = GetDocument(doclocation);
Response.AddHeader("Content-Length", response.Length.ToString());
Response.BinaryWrite(response);
Response.End();
当我硬编码一些虚拟值时,此代码只会使我的页面加载一次(应该如此)。
Response.Clear();
Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "inline;filename=data.pdf");
Response.BufferOutput = true;
byte[] response = new byte[] {10,11,12,13};
Response.AddHeader("Content-Length", response.Length.ToString());
Response.BinaryWrite(response);
Response.End();
我还在 web.config 文件中增加了请求长度以获得良好的度量。
<httpRuntime executionTimeout="180" maxRequestLength="400000"/>
依然没有。有人看到我看不到的东西吗?