O'Reilly logo

Learning ASP.NET 2.0 with AJAX by Dan Hurwitz, Jesse Liberty, Brian MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Errors, Exceptions, and Bugs, Oh My!

Every computer programmer has run into bugs. It comes with the territory. Many bugs are found during the coding process. Others pop up only when an end user per-forms a specific and unusual sequence of steps or the program receives unexpected data. You should always try to find bugs early in the development process and avoid having end users find your bugs for you. Countless studies have shown that the earlier you find a bug, the easier and less expensive it is to fix.

If your program does run into a problem, you will want to recover quickly and invisibly, or, at worst, fail gracefully. ASP.NET provides tools and features to help reach these goals:

Tracing

You can trace program execution at either the page or application level. ASP.NET provides an extensible trace log with program life-cycle information.

Symbolic debugging

You can step through your program line by line, set breakpoints, examine and modify variables and expressions, and step into and out of classes, even those written in other languages.

Error handling

You can handle standard or custom errors at the application or page level. You can also show different error pages for different errors.

To get started exploring the ASP.NET debugging tools, you should first create a simple web site to which you will add tracing code. You will then introduce bugs into the program and use the debugger to find and fix the bugs.

Creating the Sample Application

To start, create a new web site ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required