Client-Side Script Debugging
The Visual Studio debugger provides a comprehensive debugging environment for finding and correcting errors in client-side scripts in ASP.NET pages.
Before you can begin debugging script with Visual Studio, script debugging must be enabled in Internet Explorer. For more information, see How to: Enable and Start Script Debugging from Internet Explorer.
In Visual Studio 2012, you can view use Solution Explorer to view lists of server-side and client-side script documents. You can open any script document from Solution Explorer. For more information, see How to: View Script Documents.
To begin debugging script in Visual Studio, the debugger must attach to the script you want to debug. This can happen manually or automatically.
You can manually attach by using the Visual Studio debugger interface to choose a running script process you want to attach to. For more information, see How to: Attach to Script.
The debugger automatically attaches to script when one of the following things occurs:
You hit a breakpoint set in script. For more information, see How to: Set Breakpoints in Script.
You hit a VBScript Stop statement or JScript debugger statement in your script code.
The browser or server encounters a syntax or run time error in your script. When this occurs, a dialog box appears and have the option to begin debugging.
You use the Internet Explorer Script Debugger menu to begin debugging. For more information, see How to: Enable and Start Script Debugging from Internet Explorer.
When you manually attach to script, the script process continues to run until it is somehow halted. You can halt it by choosing Break on the Debug menu.
When the debugger attaches automatically, script execution is halted at the line where the breakpoint, Stop statement or debugger statement, or error occurred, or at the point where you chose to start debugging in Internet Explorer.
At that point, you can use the normal debugger facilities to begin debugging. For example, you can use Step commands to continue to execute your code line by line. You can use the Call Stack window to view and control script flow. You can use the variable windows or Immediate window to view or change variables and properties.
Visual Studio provides enhanced error messages for common script debugging problems. These messages do not appear unless you attach to Internet Explorer manually. If you encounter an error condition when Internet Explorer is opened automatically, try manually attaching so that you can see the error messages.
AJAX-enabled Web applications make heavy use of script code and pose special debugging challenges. For information about AJAX debugging techniques, see