Although it @Html.RenderPartialcalls a record and returns void, it is still written to StringWriter/ StringBuilder. Is there any way to render directly into ResponseStream?
Is it possible to do this with a custom IViewEngineone that implements rendering as PdfViewfor direct output to ResponseStream?
Addition
ViewResultBase.ExecuteResultshows what ViewContextis being built using Response.Output, but the debugger shows ViewContext.WriterhowStringWriter
Both of these approaches lead to StringWriter
return PartialView("view", Model)
// or
PartialView("view", Model).ExecuteResult(ControllerContext)
EDIT
It seems like System.Web.WebPages.WebPageBase ExecutePageHeirarchypushing temp StringWriterinto the context stack, so I'm not sure if this can be circumvented
SUMMARY
RenderPartial, RenderAction are not directly output to Response.Stream, none of the Razor Views will be
Decision
WebPages/Razor, StringWriter StringBuilder. , , WebFormViewEngine, .