ASP.NET
  Home arrow ASP.NET arrow More on Testing and Debugging an ASP.NET 2...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

More on Testing and Debugging an ASP.NET 2.0 Application
By: Murach Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2006-05-18

    Table of Contents:
  • More on Testing and Debugging an ASP.NET 2.0 Application
  • How to use the debugger
  • How to use tracepoints
  • How to control the execution of an application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    More on Testing and Debugging an ASP.NET 2.0 Application


    (Page 1 of 4 )

    In this article, you will learn how to create a website that runs under IIS for testing purposes. You will also learn how to create and test a file-system website with the ASP.NET Development Server. It is excerpted from chapter four of the book Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1890774324).

    How to use the Exception Assistant

    As you test an ASP.NET application, you may encounter runtime errors that prevent an application from executing. When that happens, an exception is thrown. In many cases, the application anticipates these exceptions and provides code to catch them and process them appropriately. If an exception is not caught, however, the application enters break mode and the Exception Assistant displays a dialog box like the one shown in figure 4-8.

    As you can see, the Exception Assistant dialog box indicates the type of exception that occurred and points to the statement that caused the error. In many cases, this information is enough to determine what caused the error and what should be done to correct it. For example, the Exception Assistant dialog box in this figure indicates that an input string value was not in the correct format. The problem was encountered in this line of code for the Order page:

      item.Quantity =
    Convert.ToInt32(txtQuantity.Text);

    Based on that information, you can assume that the Text property of the txtQuantity control contains a value that can’t be converted to an integer, since the Quantity property of the item object is declared as an integer. This could happen if the application didn’t check that the user entered an integer value into this control. (To allow this error to occur, I disabled the range validator for the Quantity text box on the Order page.)

    Many of the exceptions you’ll encounter will be system exceptions like the one shown here. These exceptions apply to general system operations such as arithmetic operations and the execution of methods. If your applications use ADO.NET, you can also encounter ADO.NET and data provider exceptions. If the connection string for a database is invalid, for example, a data provider exception will occur. And if you try to add a row to a data table with a key that already exists, an ADO.NET error will occur.

    In some cases, you won’t be able to determine the cause of an error just by analyzing the information in the Exception Assistant dialog box. Then, to get more information about the possible cause of an exception, you can use the list of troubleshooting tips in this dialog box. The items in this list are links that display additional information in a Help window. You can also use the other links in this dialog box to search for more help online, to display the content of the exception object, and to copy the details of the exception to the clipboard.

    If you still can’t determine the cause of an error, you can use the Visual Studio debugger to help you locate the problem. You’ll learn how to do that next.

    An Exception Assistant dialog box


    Figure 4-8.  How to use the Exception Assistant

    Description

    • If an uncaught exception occurs in an ASP.NET application, the application enters break mode and the Exception Assistant displays a dialog box like the one shown above.
    • The Exception Assistant provides the name and description of the exception, and it points to the statement in the program that caused the error. It also includes a list of troubleshooting tips. You can click on these tips to display additional information in a Help window.
    • The information provided by the Exception Assistant is often all you need to determine the cause of an error. If not, you can close this window and then use the debugging techniques presented in this chapter to determine the cause.
    • If you continue program execution after an exception occurs, ASP.NET terminates the application and sends a Server Error page to the browser. This page is also displayed if you run an application without debugging. It provides the name of the application, a description of the exception, and the line in the program that caused the error. It also includes a stack trace that indicates the processing that led up to the error.

    More ASP.NET Articles
    More By Murach Publishing


       · This article is an excerpt from the book "Murach's ASP.NET 2.0 Web Programming with...
     

    Buy this book now. This article is excerpted from chapter four of the book Murach's ASP.NET 2.0 Web Programming with VB 2005, written by Joel Murach and Anne Boehm (Murach, 2006; ISBN: 1890774324). Check it out today at your favorite bookstore. Buy this book now.

    ASP.NET ARTICLES

    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ
    - Developing a Dice Game Using ASP.NET Futures...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT