MVC 3 Response.Flush不起作用 [英] MVC 3 Response.Flush does not work
本文介绍了MVC 3 Response.Flush不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的看法下一个code:
I have the next code of view:
@{ Layout = null; }
@Html.Raw(ViewBag.ReportHeader as string)
@{
Response.Buffer = true;
Response.Flush();
}
@Html.Raw(ViewBag.ReportBodyAndFoot as string)
在这种情况下,我期望的页的标题中呈现的第一和然后身体与页脚,但响应发送整个页面。
In this scenario, I expected the header of the page to be rendered first and then the body with the footer, but the response sent the entire page.
推荐答案
我已经找到了答案:
public ActionResult Index(DateTime from, DateTime to)
{
PartialView("PartialViews/_ReportHeader").ExecuteResult(ControllerContext);
Response.Flush();
ViewBag.Report = new InHouseFarmInFarmOutReportGenerator().GenerateReport(from, to);
return View();
}
这篇关于MVC 3 Response.Flush不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文