Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>According to <a href="http://blogs.msdn.com/b/tmarq/archive/2008/08/27/using-iis-7-0-dynamic-compression-with-asp-net-output-cache.aspx" rel="nofollow">this blog post</a>, the DynamicCompressionModule, which is responsible for handling the dynamic compression, runs during the ReleaseRequestState stage (which occurs before the UpdateRequestCache stage, when the page is being stored to the output cache). Therefore:</p> <ul> <li>if you want to process the response before dynamic compression is performed, then you should place your filtering code in a HttpModule that hooks up to the PostRequestHandlerExecute event;</li> <li>if you want to process the response caching is performed, but after compression, then you should place your filtering code in a HttpModule that hooks up the PostReleaseRequestState event.</li> </ul> <p>Here's an example on how to do this:</p> <pre><code>public class SampleModule : IHttpModule { public void Dispose() { return; } public void Init(HttpApplication context) { context.PostRequestHandlerExecute += new EventHandler(App_OnPostRequestHandlerExecute); context.PostReleaseRequestState += new EventHandler(App_OnPostReleaseRequestState); } private void App_OnPostRequestHandlerExecute(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; HttpResponse response = app.Context.Response; response.Write("&lt;b&gt;Modified!&lt;/b&gt;"); } private void App_OnPostReleaseRequestState(object sender, EventArgs e) { HttpApplication app = (HttpApplication)sender; HttpResponse response = app.Context.Response; //check if the output has been compressed - make sure to actually test if for whatever content encoding you want to deal with if (response.Headers["Content-Encoding"] != null) { //do stuff } else { //do some other stuff } } } </code></pre> <p>And then register your module using the web.config file:</p> <pre><code>&lt;add name="SampleModule" type="My.ModuleNamespace.SampleModule" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload