Visual InterDev
You can debug client script in any of these ways:
Note To debug client script in Internet Explorer, you must be using Internet Explorer 4.0. Debugging must also be enabled in Internet Explorer (this is the default).
It is also highly recommended that you do not use Active Desktop™ mode of Internet Explorer when you are debugging, or set the option in Internet Explorer to launch each new instance of the browser in a new process.
If a Web page contains a mixture of client and server script, you can use the Visual InterDev debugger to debug both. For details, see Debugging Mixed Client and Server Script.
When Internet Information Server (IIS) processes an ASP page, the resulting page sent to the browser can be considerably different than what you see when you edit the ASP page in the editor. Server script can generate new client content dynamically, or conversely, a large quantity of server script can result in only a few lines of client HTML output. This situation introduces problems when you set breakpoints in client script inside an ASP page because the line on which you set the breakpoint can move dramatically within the file by the time the page reaches the browser.
The solution is to enable client-side debugging in ASP pages. Doing so specifies that IIS tracks the location of client script breakpoints in an ASP page, and passes the location of those breakpoints to Internet Explorer, so that Internet Explorer can stop at the correct locations.
Note If you are writing ASP pages that use the scripting object model, you can set options that help you find errors and trace events. For details, see Debugging Script Objects in ASP Pages.
Before you can debug client script in ASP pages, you must enable debugging. You can manually enable debugging for your ASP application as described under "Enabling ASP Debugging on the Server" in the Troubleshooting topic. Alternatively, Visual InterDev can automatically enable debugging on the server as needed.
Note If you intend to work exclusively with client script in .htm files, you do not need to enable server debugging or perform the following procedure.
To automatically enable client script debugging in ASP pages
Note To debug script in ASP pages, you must be running version 4.0 or later of Microsoft® Internet Information Server (IIS).
When this option is set, each time you start a debugging session Visual InterDev checks that the server is configured for debugging. This includes:
When you quit your debugging session, Visual InterDev restores the server debugging settings and out-of-process setting to their previous values.
If you are working in a Visual InterDev solution, you can debug a file by launching the debugger.
To debug a script from within a solution
Note You might experience a delay the first time you launch a debugging session for the current project while Visual InterDev establishes the proper debugging configuration on the server.
Visual InterDev launches Internet Explorer and loads the page into it. When Internet Explorer reaches the breakpoint, it stops and displays the source code in the editor window. If the breakpoint is in an event handler script, you must trigger the event to reach the breakpoint.
If a client script is already running in Internet Explorer and you detect a problem, you can stop the script and debug it on the spot. You can debug a running document from within Visual InterDev or from within Internet Explorer.
Note If you are working with an ASP page, debugging must be enabled on the server. For details, see "Enabling ASP Debugging on the Server" in the Troubleshooting topic.
You can attach to a running document only if attaching is enabled.
To enable just-in-time debugging
You can attach to a document directly in Visual InterDev.
To debug a running document in Visual InterDev
–or–
If Visual InterDev is not already running, you can launch the debugger from Internet Explorer.
To debug a running document from Internet Explorer
–or–
In Internet Explorer, choose Script Debugger from the View menu, and then choose Open.
If you make changes to the file, save it and re-deploy it to the server. Refresh the file in Internet Explorer before running the script again.
If Internet Explorer encounters a syntax or run-time error, you can use just-in-time debugging to find and fix it. You can also include a statement in your script, such as a Stop
statement in Visual Basic®, Scripting Edition (VBScript) or a debugger
statement in JScript™, to launch the debugger from within a script.
You can launch the debugger in response to an error or debugger statement only if just-in-time debugging is enabled.
To enable just-in-time debugging
To debug in response to an error or debugger statement
The page to debug is loaded into the editor. If necessary, get a working copy of the page. If the project was already open, the page is loaded as a read-only file in the new project.
Note If you are debugging a client script generated by an .asp file, the line numbers reported in error messages refer to lines in the HTML document currently displayed in the browser. These usually do not correspond to line numbers in the original .asp file, because server script does not appear in the HTML output of an .asp file. For more information, see Debugging Mixed Client and Server Script.
If you make changes to the file, save it and re-deploy it to the server. Refresh the file in Internet Explorer before running the script again.