Chapter 14: Tracing and Debugging ASP.NET Applications


Overview

In this chapter, you will learn how to:

  • Use tracing to learn how your application is running.

  • Debug ASP.NET applications.

  • Use the Visual Studio .NET debugger.

This book has covered a wide variety of topics related to ASP.NET development. I hope you’ll be able to avoid most problems while developing your ASP.NET Web applications. Inevitably, however, there will be times when your code doesn’t do what you expect it to, or you’ll run into errors or problems that prevent your application from working. This final chapter will look at what to do when that happens. It’s not intended to make you an expert debugger, but rather to give you an overview of the tools available for debugging in ASP.NET.

To say that classic ASP did not offer developers much support for debugging their applications would be a colossal understatement. Despite being a very simple and productive development environment, classic ASP left a lot to be desired in terms of debugging and error messages.

For example, in classic ASP you had no convenient way to access the state of the current HTTP request or of the other collections, such as the QueryString or Forms collections. ASP.NET addresses this issue through a new feature called tracing, which I’ll discuss in the first part of this chapter.

Additionally, classic ASP error messages were often cryptic at best. If you were lucky, they told you the line of the ASP page on which the error occurred. Unfortunately, this information could be misleading. The error might have occurred in a function called by that page, but you wouldn’t know that from the error message. ASP.NET provides much richer error reporting, including a stack trace of the functions that led up to an error condition, making it much easier to locate the root cause of the error.

The Microsoft .NET Framework SDK ships with its own debugger, so developers who are not using Microsoft Visual Studio .NET can attach it to the process of their ASP.NET application and step through their code to find and fix problems. Most often, however, using the debugger in Visual Studio .NET can be the most efficient way to debug your application. I’ll discuss the improved error reporting and the SDK debugger in the second half of this chapter.




Microsoft ASP. NET Programming with Microsoft Visual Basic. NET Version 2003 Step by Step
Microsoft ASP.NET Programming with Microsoft Visual Basic .NET Version 2003 Step By Step
ISBN: 0735619344
EAN: 2147483647
Year: 2005
Pages: 126

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net