Chapter 18. Exception Handling, Debugging, and Tracing


  • How to write code that is able to detect and handle errors that occur at runtime, at the same time shielding your users from the error details

  • How to detect errors that occur on your production machine so you can take countermeasures

  • What debugging is and what debugging tools VWD offers

  • What tools you can use to gain information about your system and code while it's running in a development or production environment

You can't make an omelet without breaking eggs and you cannot write code without creating bugs. No matter how hard you try and how good you are, your code will contain problems that affect the behavior of your web site.

Of course you should strive to minimize the impact of these bugs, aiming for a "zero bug count." To aid you in this, the ASP.NET runtime and Visual Web Developer provide you with a number of tools.

First of all, the languages supported by .NET implement exception handling, a methodology to identify and handle errors that occur at runtime. By handling these errors, you can present your users a friendly error message. At the same time you can log these errors, giving you a chance to fix them before they re-occur. In this chapter you see how exception handling works, and how to log your errors.

Before your code goes into production you need to write and debug it first. To help you debug your code, VWD comes with a rich toolset that includes ways to step through your code ...

Get Beginning ASP.NET 4: in C# and VB now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.