最初我試圖找出Response.Close和Response.End之間的區別是什麼,但在做了更多的搜索和研究之後,我清楚地知道我還沒有看到一個共同點方式一個字節[]被髮送回客戶端。我將在下面留下代碼示例,但我想知道這樣做的行業標準是什麼。ASP.NET如何流文件到用戶
Byte[] myBytes = GetReportBytes();
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AppendHeader("content-length", myBytes.Length.ToString());
HttpContext.Current.Response.AppendHeader("content-Disposition", "attachment;filename=" + this.ReportFileName + GetReportExtension());
HttpContext.Current.Response.ContentType = GetApplicationContentType();
HttpContext.Current.Response.BinaryWrite(myBytes);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Close();
//CERT FIX
//HttpContext.Current.Response.End();
感謝您的信息... – RSolberg 2009-04-10 15:43:27