5. The Exception Handling Application Block

I WAS ONCE BROUGHT into a company to help them diagnose an issue they were having with one of their applications that had already been deployed to production. The Web application was redirecting users to the home page for every request. It was causing users a great deal of pain and the company was losing a lot of business. Upon investigation, I observed that the code shown in Listing 5.1 was smattered throughout the application.

Listing 5.1. Bad Example of Exception Handling

        Try        ...        Catch ex As Exception             Response.Redirect("welcome.aspx")        End Try

Exceptions were being caught and “swallowed” by the application. There was no notification or record of the actual ...

Get Effective Use of Microsoft Enterprise Library: Building Blocks for Creating Enterprise Applications and Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.