Skip to Main Content
Learning ASP.NET 3.5, 2nd Edition
book

Learning ASP.NET 3.5, 2nd Edition

by Brian MacDonald, Dan Hurwitz, Jesse Liberty
July 2008
Beginner content levelBeginner
607 pages
16h 25m
English
O'Reilly Media, Inc.
Content preview from Learning ASP.NET 3.5, 2nd Edition

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 performs 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, stop it as it is running, 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 and display special error pages. You can also show different error pages for different errors.

There’s an additional technique for handling errors in your code: the try/catch block. A try block surrounds code that has a reasonable chance of causing a problem, such as a file not being found when you try to open it. The corresponding catch block contains ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

ASP.NET 2.0 Illustrated

ASP.NET 2.0 Illustrated

Alex Homer, Dave Sussman
ASP.NET 2.0 Unleashed

ASP.NET 2.0 Unleashed

Stephen Walther
Programming .NET 3.5

Programming .NET 3.5

Jesse Liberty, Alex Horovitz

Publisher Resources

ISBN: 9780596518455Supplemental ContentErrata Page