Chapter 6. Testing and Debugging Your ASP.NET Applications

In This Chapter

Dealing with errors

Using the debugger

Stepping through your code

Using breakpoints

Working with Response.Write

Visual Web Developer includes a variety of built-in debugging features that can help you track down the nasty bugs that are sure to creep into your application. With the applications we’ve presented so far, it’s hard for anything to go wrong because the applications don’t really do any significant work. So, this section starts by presenting a simple calculator application that we can use to explore Visual Web Developer’s debugging features.

Testing and Debugging Your ASP.NET Applications

All code listings used in this book are available for download at www.dummies.com/go/aspnetaiofd.

Creating a Simple Calculator Application

Figure 6-1 shows a simple Web page that accepts two numbers as input and displays the sum of the numbers when the user clicks the button. I’ll use this simple program as an example for the debugging features presented in this chapter.

A Simple Calculator program in action.

Figure 6-1. A Simple Calculator program in action.

The .aspx file for this page is shown in Listing 6-1. Listing 6-2 shows the version of the code-behind file for this page. Note that although this program is shown in C#, the same debugging skills apply just as easily to Visual Basic.

Example 6-1. The Default.aspx ...

Get ASP.NET 2.0 All-In-One Desk Reference For Dummies® 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.