IHttpModule and OnEndRequest

  • Thread starter Thread starter bonesbro
  • Start date Start date
B

bonesbro

How confident can I be that OnEndRequest() will always be called from
my custom IHttpModule? It looks like it's called when I
Response.Redirect() or Response.End(). What if ASP.NET kills the
thread (by raising a ThreadAbortException) due to timeout?

I assume, but am not certain, that I can't expect it to get called if
the machine is IISRESET. Short of that exceptional circumstance, is
there any other way that a request which has
IHttpModule.OnBeginRequest() called will not end in an OnEndRequest()?
 
EndRequest is supposed to get called regardless of how the request ends up
being handled. But there is only so much ASP.NET can guarentee. Perhaps IIS
terminates the worker process or perhaps the machine actually loses power.
What are you so worried about in EndRequest? Anyway, barring any of those
catastrophic things, EndRequest should get called.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
Well, let's say I am doing something in BeginRequest and EndRequest to
affect system state, like manipulating performance counters. If
there's a BeginRequest with no corresponding EndRequest the data will
get screwed up.
 
Back
Top