Microsoft KB Archive/255886: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - """ to """)
 
(One intermediate revision by the same user not shown)
Line 56: Line 56:
<br />
<br />
To debug in JScript, place the '''DEBUGGER''' statement before the line of code at which you want to pause; for example:
To debug in JScript, place the '''DEBUGGER''' statement before the line of code at which you want to pause; for example:
<pre class="codesample"><%@ Language=JScript%&gt;
<pre class="codesample"><%@ Language=JScript%>
<%
<%
     Response.Write(&quot;Hello&quot;);
     Response.Write("Hello");
     debugger
     debugger
     Response.Write(&quot;World&quot;);
     Response.Write("World");
%&gt;
%>
                 </pre>
                 </pre>
To debug a script written in VBScript, place the '''STOP''' statement before the line of code at which you want to pause; for example:
To debug a script written in VBScript, place the '''STOP''' statement before the line of code at which you want to pause; for example:
<pre class="codesample"><%
<pre class="codesample"><%
     Response.Write &quot;Hello&quot;
     Response.Write "Hello"
     Stop
     Stop
     Response.write &quot;World&quot;
     Response.write "World"
%&gt;
%>
                 </pre>
                 </pre>
When this script is run from a browser, the debugger interrupts the script and displays the .asp file with the statement pointer indicating the location of the '''DEBUGGER''' or '''STOP''' statement. At this point, you can inspect the values assigned to variables before they are passed to the component.<br />
When this script is run from a browser, the debugger interrupts the script and displays the .asp file with the statement pointer indicating the location of the '''DEBUGGER''' or '''STOP''' statement. At this point, you can inspect the values assigned to variables before they are passed to the component.<br />

Latest revision as of 13:53, 21 July 2020

Knowledge Base


INFO: How to Pause ASP Code for Debugging

Article ID: 255886

Article Last Modified on 7/14/2004



APPLIES TO

  • Microsoft Active Server Pages 4.0
  • Microsoft Internet Information Server 4.0
  • Microsoft Internet Information Services 5.0



This article was previously published under Q255886

SUMMARY

This article describes how to debug Active Server Pages (ASP) code written in Microsoft JScript or Microsoft Visual Basic Scripting Edition.

MORE INFORMATION

Before debugging server-side code, you need to enable debugging for your site. From the Microsoft Management Console (MMC), right-click the virtual directory, select Properties, and click Configuration. On the App Debugging tab, select Enable ASP server-side debugging.

To debug in JScript, place the DEBUGGER statement before the line of code at which you want to pause; for example:

<%@ Language=JScript%>
<%
    Response.Write("Hello");
    debugger
    Response.Write("World");
%>
                

To debug a script written in VBScript, place the STOP statement before the line of code at which you want to pause; for example:

<%
    Response.Write "Hello"
    Stop
    Response.write "World"
%>
                

When this script is run from a browser, the debugger interrupts the script and displays the .asp file with the statement pointer indicating the location of the DEBUGGER or STOP statement. At this point, you can inspect the values assigned to variables before they are passed to the component.

NOTE: Remember to disable debugging in production servers.

Keywords: kbinfo kbbug kbcodesnippet kbdebug KB255886