Most code samples in this book don’t include code intended to handle errors. It’s not that error handling isn’t important; but error handling can be complex, and for the most part we’ve tried to keep the sample code as simple and clear as possible. Since you’ll need to deal with errors in the real world of application programming, the first part of this chapter discusses the variety of techniques available in ASP.NET for handling errors, including custom error pages and structured exception handling -- a new feature of Visual Basic .NET.
In addition to handling errors in ASP.NET applications, most developers want to figure out what’s causing those errors. To that end, the latter part of this chapter discusses debugging using either the .NET Framework SDK debugger or Visual Studio .NET. The chapter also covers use of the ASP.NET trace feature to troubleshoot application problems.
The goal of error handling (also known as exception handling) is quite simple: to prevent exceptions or errors thrown during the execution of an application request from reaching users. Ideally, users should not know that an exception occurred, or they should at least be provided with an informative message that tells them what they can do to resolve the problem. ASP.NET provides three techniques for achieving this goal:
Allow you to assign one or more error pages to be displayed when an exception occurs.