MVC 3 Response.Flush not working

I have the following view code:

@{ Layout = null; } @Html.Raw(ViewBag.ReportHeader as string) @{ Response.Buffer = true; Response.Flush(); } @Html.Raw(ViewBag.ReportBodyAndFoot as string) 

In this case, I expected the page title to be displayed first, and then the body with the footer, but the response sent the whole page.

+2
source share
1 answer

I found the answer:

 public ActionResult Index(DateTime from, DateTime to) { PartialView("PartialViews/_ReportHeader").ExecuteResult(ControllerContext); Response.Flush(); ViewBag.Report = new InHouseFarmInFarmOutReportGenerator().GenerateReport(from, to); return View(); } 
+4
source

All Articles