IHttpModule and OnEndRequest

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()?
 
B

Brock Allen

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.
 
B

bonesbro

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top