问题
How can I send some part of the web response without waiting the all rendering process finish? I prefer do that in an Action.
I used to use Response.Buffer = false;
in .net 2.0 but now with MVC 3 I don't know how to do that.
回答1:
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: I have not checked if this works though.
来源:https://stackoverflow.com/questions/13014261/how-to-bufferise-the-response-from-the-action