title: Write Outputstream in new window
body: <p>How can I write an Outputstream in a new browser window? </p>
  
  <p>Currently, I have the code below. Obviously it opens the stream in the same window. I know I can write the <strong>Outputstream</strong> to a file and open it in a new window but that isn't an option.</p>
  
  <pre><code>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();
    }
  </code></pre>