Basically, I'm trying to write the following (pseudocode) in an ASP.NET HttpModule:
*pre-code*
try { handler.ProcessRequest(...) }
catch (Exception) { *error-code* }
finally { *post-code* }
I've found that I can hook into HttpModule.PreExecuteHandler for "pre-code" and .Error for "error-code". But PostExecuteHandler doesn't seem to be running reliably.
BeginRequest and EndRequest run reliably but are too early for the code I need to write, which requires inspection of the handler that was chosen to execute. The handler isn't chosen until after BeginRequest.
Is there a best practice for writing this kind of wrapper?
Thanks!