Reponds.appendHeader无法在IE上运行

时间:2012-12-04 14:42:12

标签: c# redirect

我正在使用C#。 使用此语法Response.AppendHeader(“REFRESH”,“2; URL = .. / Ordres.aspx”);在Firefox和Chrome上工作

 using (MemoryStream ms = new MemoryStream())
                    {
                        try
                        {
                            PdfExportOptions opts = new PdfExportOptions();
                            opts.ShowPrintDialogOnOpen = true;
                            xtraReport_Pricipal.ExportToPdf(ms, opts);
                            ms.Seek(0, SeekOrigin.Begin);
                            byte[] report = ms.ToArray();
                            Page.Response.ContentType = "application/pdf";
                            Page.Response.Clear();
                            Page.Response.OutputStream.Write(report, 0, report.Length);
                            HttpContext.Current.ApplicationInstance.CompleteRequest();
                        }
                        finally
                        {
                            ms.Close();
                        }
                    }

Response.AppendHeader("REFRESH", "2;URL=../Ordres.aspx");

但不在Internet Explorer上。如何在IE上2秒后重定向页面?

提前致谢

1 个答案:

答案 0 :(得分:0)

使用

 response.AppendHeader("Content-Disposition", string.Format("attachment;filename={0}", fileName));