Tag Archive | Trace

Debugging ASP.NET AJAX

Debugging javascript

Debugging an ASP.NET AJAX application presents its own issues. It is not the classic debugging process, because here, our code is hosted within a browser (in other words, the code is interpreted by another process). So first, we must configure our browser to enable script debugging. This is not a big thing to accomplish, just open Internet Explorer, select tools, Internet Options, and then the Advanced tab. There, you should seek for a checkbox names Disable Script Debugging (Internet Explorer). Clear it, and script debugging is enabled. Clear the other one with the same name and you can debug client script in other browser, too.

There is a little problem yet. You will notice it when you start browsing whatever site you would like. A pop-up window will constantly shows up, and informs you about the found script errors on a given page. This behavior cannot be turned off, so you should only enable script debugging, when you are debugging, otherwise you can debug the whole Internet.

With client-side script debugging enabled, you can set breakpoints in javascript code, read the values of your variables at runtime, etc. If you take a look at your page when doing client-side script debugging, you will see that you are working with the rendered HTML page, so you won’t see any <asp:something> tags, but rendered HTML code. Because HTML is stateless, there would be no point in modifying the variable values when debugging. This is a necessary constraint in client-side script debugging, so be aware of it.

Attach to script

Attaching to a running script is easy. Just use Visual Studio’s (note that Express editions cannot attach to processes) Attach to Process, and select the script you’d like to attach to. You can narrow the available processes considerably if you look only for Script processes (in the Category column).

Read More…

ASP.NET Tracing

With tracing, you can access data from a running application, with the help of a browser. In ASP.NET, you can access to the following information:

  • The details of the request
  • Trace information: performance information of the Web page’s life cycle events
  • Control tree: size information about controls.
  • Session state: displays session variables and values
  • Application state: displays application variables and their values
  • Request cookie collection: list of cookies passed to the server as part of the request
  • Response cookie collections: list of cookies passed to the browser as part of the response
  • Headers collection: the list of HTTP headers sent with the request
  • Form collection: postback values.
  • QueryString collection: the variables of the query string.
  • Server variables: all server variables.

Read More…