ASP.Net MVC 3 Razor Response.Write position

后端 未结 4 1836
醉酒成梦
醉酒成梦 2021-02-12 17:47

I am trying to update this tutorial on implementing Facebooks BigPipe to razor.

There is a html helper extension that adds a pagelet to a list, and then outputs a holdin

4条回答
  •  抹茶落季
    2021-02-12 17:57

    A Razor view is rendered inside-out. Basically it writes content to temporary buffers which get written to the response stream when the top most layout page is reached. Thus, writing directly to the response stream from your HtmlHelper extension, will output it out of order.

    The solution is to use:

    helper.ViewContext.Writer.Write("
    ");

提交回复
热议问题