如何通过Response.BinaryWrite()留下空白页?

时间:2015-09-30 18:25:12

标签: asp.net stream

我正在使用.NET Reponse.BinaryWrite()方法在代码中获取Byte []值并将其生成为pdf文件。我需要在某个页面上留一个空页面。是否可以这样做?

 protected override void Render(HtmlTextWriter writer)
    {
        base.Render(writer);
        string mimeType;
        string encoding;
        string fileNameExtension;
        string[] streams;
        Microsoft.Reporting.WebForms.Warning[] warnings;

        Byte[] reportDoc;
        Response.Clear();
        switch (Request.QueryString["report"].ToString().ToLower())
        {
            case "rpt_penetrantlog":
            case "rpt_proccdbyregion":
            case "rpt_ordersbycustomeranddate":
            case "rpt_hold":
                reportDoc = rptviewOzark.LocalReport.Render("Excel", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
                Response.ContentType = mimeType;
                Response.AddHeader("content-disposition", "attachment; filename=Report.xls");
                break;
            default:
                reportDoc = rptviewOzark.LocalReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
                Response.ContentType = "application/pdf";
                break;
        }

        Response.BinaryWrite(reportDoc);
        Response.Flush();
        Response.End();
    }

报告是从SQL服务器中提取的

0 个答案:

没有答案