1

say I have a folder in my web app, with an index.html inside it:

/test
/test/index.html

and the following Module

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
    }
}

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

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

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

HeadersWritten: true
Headers: Server=Microsoft-IIS%2f7.5

What is causing this second invocation?

on the Requestthe FilePath property for the first invocation is /test/index.html, and for the second its /test/

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

Thanks

Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
  • Please see the answer to this question: http://stackoverflow.com/questions/2382094/how-can-i-tell-when-http-headers-have-been-sent-in-an-asp-net-application – Chris Haines Nov 29 '13 at 12:44

0 Answers0