How to Perform Debugging and Tracing in ASP.Net?
Published on 28 August 15
0
0
Every developer checks for potential errors before launching the web application they have painstakingly developed. Two functionality, debugging and tracing, help track the error and remove all traces of the bug. In ASP.Net Ajax applications, debugging becomes a challenge as there is a good mix of client side and server side code, wherein the client side code contains scripts, styles and HTML markups.
As a developer, you will need to overcome these challenges, and offer to debug the code and remove the potential errors. Here's how you can perform both debugging and tracing for Ajax ASP.Net applications.
Methods to Enable Debugging
Let's begin by understanding the gist of debugging. It is the process of setting breakpoints along the code so that you can track the potential errors. One of the potential methods is including debug class in the Sys namespace. Of course, there are other methods too, some of which are listed below
- Enable debugging in web browser
- Integrate Visual Studio debugger to web browser you are using
- Using the Sys.Debug Class to track the errors
The methods you can adopt include one of the above mentioned three. Of course, you can also use the server side tracing method to conduct the debugging of errors. You can even trap the HTTP traffic by using external tools for this purpose.
Let's enable debugging support for your AJAX based ASP.Net application. Here's the code that you need to use
<configuration>
<system.web>
<compilation debug = "true">
</compilation>
</system.web>
<configuration><configuration>
<system.web>
<compilation debug = "false">
</compilation>
</system.web>
<configuration><asp:ScriptManager ID="ScriptManager1" runat="server" ScriptMode="Debug"> :
How to enable debugging in the IE web browser that you are currently using? Try incorporating the below mentioned five steps to process debugging
- Go to Tools menu in the browser, and select internet as your option
- Go to advanced tab and here you need to disable script debugging checkbox
- Finally, select display notification checkbox and disable the unfriendly messages
If you are using the Sys. Debug class, then here are the methods that will enable tracing and debugging
- Sys.Debug.trace(message)
- Sys.Debug.clearTrace()
- Sys.Debug.fail(message)
- Sys.Debug.assert(condition, message, displayCaller)
- Sys.Debug.traceDump(object,name)
Methods to Enable Tracing
With tracing, you can display the execution path and helps display the diagnostic information when you execute the application. You can list out the methods in the Sys.Debug class to help debug the application, trace the output and display the trace messages.
The following code is one of the many methods using which you can trace the output
snippet:this._appendConsole(textMessage);
_appendTrace(textMessage);
<configuration
<system.web>
<compilation debug = "true">
//usual configuration code
</compilation>
</system.web>
<configuration>Both debugging and tracing are internal functions built into the ASP.Net Ajax using which you can easily debug and trace the potential errors. This will help improve the pace of improvising the whole application, and deploy it faster. Hire ASP.Net Programmers to give out an application suited to your business needs.
This blog is listed under
Development & Implementations
Community
Post a Comment
You may also be interested in
Share your perspective
Share your achievement or new finding or bring a new tech idea to life. Your IT community is waiting!