title: HttpResponse filter returns nothing
body: <p>I have written a HttpModule that I am using to intercept calls the the WebResource.axd handler so I can perform some post processing on the javascript.</p>
  
  <p>The module wraps the Response.Filter stream to perform its processing and writes it's changes to the underlying stream.</p>
  
  <p>The problem I have is that the script does not get returned to the browser.</p>
  
  <p>So as a really simple example that just acts as a pass through, the module looks like this:</p>
  
  <pre><code> public class ResourceModule : IHttpModule
  {
      public void Dispose()
      {
      }
  
      public void Init(HttpApplication context)
      {
          context.PostRequestHandlerExecute += new EventHandler(context_PostRequestHandlerExecute);
      }
  
      void context_PostRequestHandlerExecute(object sender, EventArgs e)
      {
          HttpApplication context = sender as HttpApplication;
  
          if (context.Request.Url.ToString().Contains("WebResource.axd"))
          {
              context.Response.Filter = new ResourceFilter(context.Response.Filter);
          }
      }
  }
  </code></pre>
  
  <p>and the ResourceFilter that just outputs what it receives looks like this:</p>
  
  <pre><code> public class ResourceFilter : MemoryStream
  {
      private Stream inner;
  
      public ResourceFilter(Stream inner)
      {
          this.inner = inner;
      }
  
      public override void Write(byte[] buffer, int offset, int count)
      {
          inner.Write(buffer, offset, count);
      }
  }
  </code></pre>
  
  <p>I can attach and see the module and filter being invoked, but when I browse to WebResource.axd url I get nothing back.</p>
  
  <p>I have used this pattern to implement modules that perform processing on aspx pages and they work just fine.  It appears there is something about the interaction with the WebResource.axd that prevents this working.</p>