如何缓冲动作的响应? [英] How to bufferise the response from the action?
本文介绍了如何缓冲动作的响应?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在不等待所有渲染过程完成的情况下发送部分Web响应? 我更喜欢在一个动作中做到这一点.
How can I send some part of the web response without waiting the all rendering process finish? I prefer do that in an Action.
我曾经在.net 2.0中使用Response.Buffer = false;
,但是现在在MVC 3中我不知道该怎么做.
I used to use Response.Buffer = false;
in .net 2.0 but now with MVC 3 I don't know how to do that.
推荐答案
您可以潜在地使用操作过滤器来设置Buffer属性.
You can potentially use an Action Filter to set the Buffer property.
public class BufferActionFilter: ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
filterContext.HttpContext.Response.Buffer = true;
}
}
PS:我还没有检查这是否可行.
PS: I have not checked if this works though.
这篇关于如何缓冲动作的响应?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文