title: How to make static Html page go through HttpModule in IIS7.0?
body: <p>I have created a simple HttpModule which removes whitespaces from response before sending it to the client. This works fine for an aspx page on IIS7.0 but if i create a static html page and call it, the HttpModule does not kick in (the way i know is because the source contains whitespaces, which otherwise should have been removed). Apparently there is something i m not doing right, but dont know what.</p>
  
  <p>My website is in an Application Pool with .NET 4.0 and <code>ManagedPipelineMode = Integrated</code>.</p>
  
  <p>I have added my module as a ManagedModule and refers to an strong-name-key assembly from GAC.</p>
  
  <p>thanks</p>
  
  <p>Edit- here is the system.webserver part from web.config </p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;system.webServer&gt;
    ...
    &lt;modules runAllManagedModulesForAllRequests="true"&gt;
      &lt;add name="RemoveWhitespaceHttpModule" 
           type="HttpModules.Modules.RemoveWhitespaceHttpModule, HttpModules, 
             Version=1.0.0.0, Culture=neutral, PublicKeyToken=8a83u4bi47o9fo0d" 
             preCondition="" /&gt;
    &lt;/modules&gt;
    &lt;defaultDocument&gt;
      &lt;files&gt;
        &lt;add value="TestForm.aspx" /&gt;
      &lt;/files&gt;
    &lt;/defaultDocument&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Edit- Fixed it. For anyone interested, this is how my module checks the response and then decides whether to proceed with whitespace removal or not </p>
  
  <pre><code>if (contentType.Equals("text/html") 
    &amp;&amp; httpContext.Response.StatusCode == 200 
    &amp;&amp; httpContext.CurrentHandler != null)
  { ... }
  </code></pre>
  
  <p>The problem was with the third condition above <strong>httpContext.CurrentHandler != null</strong>. when calling this module for static .html pages, the currentHandler was null and hence the code never went inside to manipulate html. i have removed this third condition and it works now. thanks for your answers everyone</p>