Debugging Web project script
When you are developing a Web application in a Web project, you can debug client-side script (such as client-side JavaScript or VB Script) that is hosted by Web pages (HTML or JSPs) in the project.
The easiest way to debug Web project script is via the Debug on Server action. This action will deploy the Web project to the server for you, and then launch the debug session. To be able to debug script when working in a Web project, first ensure that script debugging is enabled for server debugging. You set this in the debug preferences (for further information, see the related topic below). Once you have enabled script debugging, you can launch a debug session by doing the following:
In the Navigator view, right-click the Web project and choose Debug on Server from the pop-up menu. In the resulting dialogs, choose the server that you wish to run the application on and then proceed with all other dialog defaults.
Note: If you have not yet created the server, you will be prompted to do so before proceeding with the debug on server action. Click Finish to deploy the project to the server. You will be prompted via a dialog to select a server client. In this dialog, choose Active Script Debug and then Finish. The application will launch in Internet Explorer. After the debug session has launched, proceed in the application to the page that contains the script that you wish to debug. Before invoking the script (via Internet Explorer), halt the Active Script debug session. For information about halting, see the related topic below. Invoke the script that you wish to debug. The debugger will stop the script at the first possible statement.
For further information about the debug on server action, search for 'debug on server' in the online help.
In addition to using the debug on server action, you can deploy your Web application to the server and then use the HTML Script Application launch configuration to attach to or launch the script in the Web application. For information about this, see the related topic below.
Note:
- Suspending Web project page execution and displaying source: When you are debugging Web objects that are running on a server (such as JSPs that generate script or forms in HTML) and you wish to suspend execution for that script, you need to issue a suspend action on the thread before launching the script action. If you do not do this, the debugger will not halt within that action, and debugger will not display source for the script. Once you've suspended execution, selecting the strack frame will result in a display of the source that is hosted by Microsoft Internet Explorer. For information about halting program execution, see the related topic below.
- Setting breakpoints in Web project pages: When you are debugging Web objects that are running on a server, the debugger will display source as outlined above. Breakpoints that are set in this source are installed by the debugger - however, breakpoints that you set in source opened from your workspace will not be installed. You cannot, therefore, preset breakpoints in Web project pages.
- When you launch a Web application for debugging, any server-side Web objects in the application will launch for debugging, as well. These objects will run in the server test environment, independent of an Active Script debug session. Terminating a server-side debug session will not affect your Active Script debug session, and vice-versa.
Related tasks
Preparing to debug
Setting debug preferences
Starting a debug session
Debugging an HTML Script Application
Debugging a Script Host Application
Using the Debug view
Terminating a debug session
Debug on Server
Halting a running program
Editing and viewing source while debugging