Address: http://aspalliance.com/1096_Debugging_JavaScript_in_Visual_Studio
[Translation] debugging JavaScript in Visual Studio
Original article released on: 2006.12.19
By Rajendra Kumar Sahu
Translation: webabcd
Summary
A good application must pass verification before committing all input items to the server for processing. Therefore, client verification is required. Almost all browsers support JavaScript to complete this task very well.
Article content
Introduction
Configuration
Conclusion
Introduction
In fact, web applications are more convenient to upgrade than desktop applications. For example, from the perspective of applications, the development of these two technologies is undoubtedly more popular than desktop applications. Web Application designers are different from Desktop Application designers. web pages are composed of Static html tags, images, script tags, and JavaScript. Web pages are combined with web servers to deliver requests to the server through a browser for processing. Today, there are many different web servers. Popular ones include IIS, WebSphere, Weblogic, and Apache. Web servers are used to process scripts, and some basic class libraries are used to process these scripts. When a page sends a request from a browser to the server, html tags are not converted. the browser is responsible for interpreting and parsing these html tags.
Today, Web pages are becoming more and more interactive. They often collect user input and send the information to the server for processing. Therefore, verifying each input on the page is part of the developer's work. Web page verification is already necessary. If client-side authentication is not performed, some wrong requests may occur, which may cause the web application to throw an error message or even crash. In addition to input verification on the server, client verification is also required. Some popular scripts can be used for client verification. JavaScript and VBScript are two of them. There is no script specifically designed to cope with web-side verification, which puts developers into an embarrassing situation. In today's era, users prefer to do more things on the client, but only give them to the server when necessary.
This technology is completely processed on the client. It is not ajax (Asynchronous Java and XML ). I have used ajax in some occasions. It is indeed very powerful and different from JavaScript, but it still needs a lot of JavaScript in ajax. Developers have to write a large amount of logic code into JavaScirpt. With the increasing use of JavaScript, more and more time will be used to debug and modify these JavaScript. Microsoft Visual Studio IDE allows developers to easily write code, and debugging is much easier than traditional asp applications. Let go of some new features of vs ide. Many people find it inconvenient to debug JavaScript. But now you can use some configurations to make debugging JavaScript easier. So how should we do it? Next, I will show you some tips for debugging objective cirpt in asp.net.
In asp.net, I debug JavaScript step by step. In this article, I used IIS and Visual Studio 2005.
Configuration
Step 1:
Open an existing asp.net application in Visual Studio 2003/05, which 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 <compilation debug = "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.
Conclusion
[Source code download]
This is a very simple example of debugging JavaScript.