title: HttpResponse.Filter in MVC 6 / vNext?
body: <p>I'm working on a website framework that uses "Widgets" to render content chunks inside of a portal/portlet type website.  Basically a very abbreviated version of how Wordpress lets you customize a website.</p>
  
  <p>Having searched and failed at finding any existing frameworks, it seems like the most reasonable way to implement this is to use the "Partial Views" feature of MVC.</p>
  
  <p>I'd like to be able to fully encapsulate each "widget" without having to repeat script or style tags in the host View (Views shouldn't need to know anything about how to render the Widgets). </p>
  
  <p>To accomplish this, any script references are stored by the Widget Partial View and later injected when the View renders its own script section.  In one instance, this was implemented using a response filter.</p>
  
  <p>I'm using MVC 6 (vNext) via CoreCLR and am trying to determine how to implement this filter bit under the new framework.  It seems like the HttpResponse object no longer has a "Filter" field.</p>
  
  <p>Can you tell me how this might work under the new framework?</p>
  
  <pre><code>/// &lt;summary&gt;
  /// Appends partial view scripts to the html response of an AJAX request
  /// &lt;/summary&gt;
  public class RenderAjaxPartialScriptsAttribute : ActionFilterAttribute
  {
      public override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          if (filterContext.HttpContext.Request.IsAjaxRequest())
          {
              var response = filterContext.HttpContext.Response;
              if (response.Filter != null)
              response.Filter = new RenderAjaxPartialScriptsResponseFilter(response.Filter, filterContext);
          }
      }
  }
  </code></pre>
  
  <p>Original code came from Ryan Burnham's Blog at <a href="https://rburnham.wordpress.com/2015/03/13/asp-net-mvc-defining-scripts-in-partial-views/#comment-2286" rel="nofollow">https://rburnham.wordpress.com/2015/03/13/asp-net-mvc-defining-scripts-in-partial-views/#comment-2286</a></p>