Search code examples
c#asp.net-4.0httpmodule

Http Module - detect if Response.End was called


I have an http module that tests for certain values in the BeginRequest method. On failure, I am writing a log and calling Response.End.

Now, I'm also doing a few things with the response in the EndRequest. I'd like to bypass those items if the BeginRequest tests failed. Unfortunately, Response.End doesn't exactly kill the pipeline.

So, is there any way to detect that response.end was called in the EndRequest event OR is there some other way I can accomplish this?


Solution

  • if you only want to know if you called Response.End in your BeginRequest than store a boolean in the HttpContext.Current.Items collection and read that out in the EndRequest