ASP Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.11

Microsoft Script Debugger

ASP Tutorials - Herong's Tutorial Notes © Dr. Herong Yang

hyBook - Guestbook Application

Using MS Access Databases

ActiveX Data Object (ADO)

Controlling Response Header Lines

Microsoft Scripting Runtime DLL

Using Cookies

ASP Sessions

ASP Objects

Microsoft Script Debugger

Internet Information Services (IIS)

... Table of Contents

Running MS Script Debugger

MS Script Debugger can be used to debug both client side and server side scripts. Here is how to set up your system to debug server side VBScript pages.

1. Turning on debugging support on the IIS server. Run Internet Services Manager, and right mouse click on Default Web Site to select Properties. On the properties dialog box, click the Home Directory tab, and click the Configuration button. Then on the configuration dialog box, click the App Debugging tab. Then click the check box for "Enable ASP server-side script debugging".

2. Running MS Script Debugger. On Windows 2000 systems, you should go to the Start button, then select Programs, then select Accessories, you will see MS Script Debugger is installed there. So run it from there.

3. Loading the ASP page to IIS. Use IE to request the ASP you want to debug. This will trigger the ASP page to be loaded into IIS.

4. Loading your ASP page into the debugger. On MS Script Debugger, select Running Documents from the View menu, you will see the Running Documents window showing up with a tree view of running IE browsers and IIS server. Follow the tree view to locate the IIS server, then Default Web Site, then the ASP page you want to debug. Double click on the ASP page to load the ASP page source code into the debugger.

5. Setting a breakpoint in the ASP source code. With the ASP source code loaded in the bugger, you can set up break points by locating the statements and click the breakpoint icon.

6. Running the ASP page to the breakpoint. Use IE to request your ASP page again. Now IIS will stop processing the ASP page at your breakpoint for debugging.

Debugging ASP Pages

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.

Dr. Herong Yang, updated in 2002
ASP Tutorials - Herong's Tutorial Notes - Microsoft Script Debugger