In Asp.net, debug JavaScript step by step. In this article Article IIS and Visual Studio 2005 are used.
Configuration
Step 1:
Open an existing Asp.net application in Visual Studio 2003/05ProgramWhich requires some JavaScript.
Step 2:
When we create a web project in Microsoft Visual Studio, a file named Web. config is created in this web project by default.
Let's check its settings.<CompilationDebug= "False"Strict= "False"Explicit= "True" />
Set the debug attribute to true as follows:
< Compilation Debug = "True" Strict = "False" Explicit = "True" />
Step 3:
Open Internet Information Service (IIS) Manager
Start> Administrative Tools> Internet Information Service (IIS) manager-> website-> default website-> right-click the web project you want to debug-> properties-> virtual directory tab-> Configuration-> select debug in the new windows window tab-> select the check boxes "enable ASP server script debugging" and "enable ASP Client script debugging. (See 1)
Figure 1
Step 4:
Open IE, click "Tools"-> Internet Options-> Advanced tab-> cancel "Disable script debugging (Internet Explorer)" and "Disable script debugging (Others)" in the menu bar). (See 2)
Figure 2
Step 5:
Now, open your web project in Visual Studio IDE.
Note: javascript must be placed in a separate. js file, instead of writing JavaScript directly on the. ASPX page. Then add a breakpoint to a line in the. js file just like the. CS or. VB file.
Step 6:
When you run your web project, the program stops running at the breakpoint you set.