MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

How to Perform Debugging and Tracing in ASP.Net?

Published on 28 August 15
0
0
How to Perform Debugging and Tracing in ASP.Net? - Image 1
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>

Let's say you want to disable the debugging support, then here's the code for you

<configuration>
<system.web>
<compilation debug = "false">
</compilation>
</system.web>
<configuration>

Before you release the application, try to set the release version for the same. Set the ScriptMode property of the application to release the Scriptmanager controls before you deploy the app. You should also set IsDebuggingEnabled attribute in the application to true before you can begin with debugging.
<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);

If you can output the text message to the TextArea control you can use the following code
_appendTrace(textMessage);

Use the ClearTrace method to clear the trace console.

<configuration
<system.web>
<compilation debug = "true">
//usual configuration code
</compilation>
</system.web>
<configuration>


Conclusion:
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

Related Posts:
Post a Comment

Please notify me the replies via email.

Important:
  • We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
  • To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
  • Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
You may also be interested in
 
Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top