ASP.NET Request Lifecycle
<p>say I have a folder in my web app, with an <code>index.html</code> inside it:</p>

<pre><code>/test
/test/index.html
</code></pre>

<p>and the following <code>Module</code></p>

<pre><code>public class TestModule : IHttpModule
{
    public void Init(HttpApplication context)
    {
        context.ReleaseRequestState += context_ReleaseRequestState;
    }

    static void context_ReleaseRequestState(object sender, EventArgs e)
    {
        var application = sender as HttpApplication;

        // foo
    }
}
</code></pre>

<p>If I make a request to <code>/test/index.html</code>, <code>context_ReleaseRequestState</code> fires and the response is returned, great.</p>

<p>If I make a request to <code>/test/</code>, <code>context_ReleaseRequestState</code> fires as above, the response is returned, but then <code>context_ReleaseRequestState</code> fires again!</p>

<p>The response has already been returned (and the connection closed, etc).
The <code>HttpContext.Response</code> object has the followng properties set on it:</p>

<pre><code>HeadersWritten: true
Headers: Server=Microsoft-IIS%2f7.5
</code></pre>

<p>What is causing this second invocation?</p>

<p>on the <code>Request</code>the <code>FilePath</code> property for the first invocation is <code>/test/index.html</code>, and for the second its <code>/test/</code></p>

<p>Is there some property on the <code>HttpApplication</code> or <code>HttpRequest</code> that I can check that identifies this 2nd request for whatever it is? The <code>HeadersWritten</code> property is internal :(</p>

<p>Thanks</p>
