Introduction

The recipes in this chapter show how you can locate problems in your ASP.NET applications by using features that support tracing and debugging.

The first seven recipes show how to use tracing to pinpoint the causes of problems in your code. Tracing allows you, through a configuration setting or page-level attribute, to have ASP.NET write a whole host of information about the executing request to the page or to a trace log. We start by discussing how you initiate page-and application-level tracing. We show how you can dynamically turn on page-level tracing when an exception occurs. Next, we show you how to make tracing work for components—those that will run on the web, as well as those that will be used elsewhere. The latter technique is important when you don’t want your use of tracing-related code to preclude you from using a component outside of ASP.NET. We also show you how to write trace information to the event log and send the information via email from within a component.

Finally, we discuss debugging, specifically how setting conditional breakpoints can be a powerful technique for debugging your ASP.NET applications. Setting conditional breakpoints is especially useful for stopping execution at a specific point in iteration-heavy code, the focus of one of this chapter’s recipes.

The recipes in this chapter are intended to help remove some of the mystery of tracing and debugging, and, in the process, help you use these techniques earlier in the development ...

Get ASP.NET 2.0 Cookbook, 2nd Edition 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.