Rants, rambles, news and notes from another geek

Using IHttpHandler to Add Error Handling to ASPX Pages

I was just putting together a presentation on the ASP.NET Runtime/Pipeline for a customer when this little tidbit popped up&nbsp_place_holder;on Craig Andera’s weblog.

Basically Craig needed to add error handling to a whole&nbsp_place_holder;bunch of ASPX pages and he didn’t want to mess up the code that was already there.

IHttpHandler to the rescue! Since IHttpHandler is what is really driving the whole ASPX process anyway, and since System.Web.UI.Page implements IHttpHandler, you can reimplement it yourself and provide a try..catch block to catch those pesky exceptions.

Read Craig’s post for a nice code sample.