Raleigh Code Camp: User Friendly Exception Handling Strategies

I had a great time at today's Raleigh MSDN Code Camp. There's nothing better than geeking out with a bunch of guys (and gals) who are as passionate about this stuff as you are!


This is a companion discussion topic for the original blog entry at: http://www.codinghorror.com/blog/2005/04/raleigh-code-camp-user-friendly-exception-handling-strategies.html

You mentioned

" However, avoid Global.asax and Application_Error in favor of the HttpModule approach

It’s much more flexible"

Can you mention why ? (any special benifits etc) I was using the Global.asax in the current web application I’m working on.There are a number of articles
like
http://www.15seconds.com/issue/030102.htm
for example.

Thanks
a.m

They are functionally the same, however, the HttpModule can be implemented without recompilation. This means I could take your ASP.NET website, without any access to the source code, and add a complete Unhandled Exception Handling strategy by simply

  1. dropping a .DLL in the /bin folder
  2. making a small edit to your Web.config

That’s what I mean by “more flexible”. It lets you turn your error handling into a pluggable module for all your future websites.

Thanks for the clarification. It was helpfull
a.m

  1. dropping a .DLL in the /bin folder does that mean I have to recompile the project again ?? Like If I had the UnhandledHttpModule.vb + edit web config means I have to compile the project again ? and then drop the assembly into the bin ??

I have to compile the project again

No, you don’t have to recompile anything when using the IHttpModule approach. That’s why it’s so powerful.

However, when you modify web.config your ASP.NET application will restart-- that’s it.

thanks for the info