Debugging ASP Pages

This section provides a tutorial example on how to use MS Script Debugger and find a bug in an ASP script example page.

Now we know how to set up the ASP page to run in the debugger. Let's play the debugger with the following ASP page.

<%@ language="vbscript"%>
<!-- debug_test.asp
     Copyright (c) 2002 by Dr. Herong Yang
     This program has a create and open files as text stream 
     objects.
-->
<html><body>
<%
   response.write("<b>Calculating term deposit income</b>:<br/>")
   capital = 100
   interest = 8.0
   term = 10
   value = capital
   for i = 1 to term
     value = value * (1+interest/100)
   next
   response.write("Capital = " & capital & "<br/>")
   response.write("Interest = " & interest & "<br/>")
   response.write("# of terms = " & term & "<br/>")
   response.write("Value = " & value & "<br/>")
%>
</body></html>

Now load the ASP page to IIS and the debugger. If you put a breakpoint at the beginning of the "for" statement and request the page, IIS will execute the page and stop at the breakpoint. Here is what we can do with the debugger.

1. If you click the step over icon, IIS will execute the current statement and stop at the next statement.

2. If you want to see the value of variable "interest", you need to select Command Window from View menu. In the command window, type "? interest", you will see the value of "interest", 8, displayed.

3. Actually "?" command in the command window can be used to evaluate any expression. Try this: "? interest/100", you will get 0.08.

4. Further more, you can execute any VBScript statements in the command window. For example, "interest = 7.5" will change the value in "interest" to 7.5.

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

MS Script Debugger

 Running MS Script Debugger

Debugging ASP Pages

 VBScript Language

 ASP Built-in Run-time Objects

 ASP Session

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

 Managing Response Header Lines

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

 Working with MS Access Database

 Guest Book Application Example

 References

 Full Version in PDF/EPUB