Using Trace in ASP.NET

April 23, 2008 | In Development |

I was called upon by a colleague of mine to help him find the source of his error in his ASP.NET application. It looked like the application was loosing session information and he couldn’t figure out how.

The first thing I did was turn on tracing in the web.config file. This is a very useful debugging tool that, among other things, displays the contents of the server side session variables.

You can enable tracing by adding the following line into your web.config, or you can turn it on for specific pages as need.

<trace enabled="true" pageOutput="true" localOnly="true" />

There are a number of different options, and you need to look at the Microsoft documentation (or any good book) for a complete list and description.   The basics in the above line are enabled which enables or disables the tracing.  Pageoutput will append the trace information to the bottom of the page as rendered in the browser and localonly which determines whether this output is seen on local machines or remote servers too.

This can be a very useful tool for quickly diagnosing issues in live/demo sites .

No Comments yet

TrackBack URI

Sorry, the comment form is closed at this time.

Login | XFN| WP
Powered by WordPress with cmb-web Theme design by Christian Bridge-Harrington.
Blog feed. Valid XHTML and CSS. ^Top^