如何在新的浏览器窗口中编写输出流?
目前,我有下面的代码。显然它会在同一个窗口中打开流。我知道我可以将输出流写入文件并在新窗口中打开它,但这不是一个选项。
protected void openPDF(byte[] dados) {
HttpContext contexto = HttpContext.Current;
contexto.Response.Clear();
contexto.Response.AppendHeader("content-type", "application/pdf");
contexto.Response.AppendHeader("Expires","Mon, 26 Jul 1990 05:00:00 GMT");
contexto.Response.AppendHeader("Cache-Control","no-cache, must-revalidate");
contexto.Response.AppendHeader("Pragma","no-cache");
contexto.Response.Expires = -1;
contexto.Response.AppendHeader("Content-Disposition", "inline; filename=labels.pdf");
contexto.Response.AddHeader("content-length", dados.Length.ToString());
contexto.Response.OutputStream.Write(dados, 0, dados.Length);
contexto.Response.OutputStream.Flush();
contexto.Response.End();
}