Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在不等待所有渲染过程完成的情况下发送部分 Web 响应?我更喜欢在动作中这样做。
我曾经Response.Buffer = false;在 .net 2.0 中使用,但现在使用 MVC 3 我不知道该怎么做。
Response.Buffer = false;
您可以使用 Action Filter 来设置 Buffer 属性。
public class BufferActionFilter: ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { filterContext.HttpContext.Response.Buffer = true; } }
PS:我还没有检查这是否有效。