Tuesday, February 5, 2013

Add diagnostics.trace output to your asp.net trace.axd

For any of you that don't know, any Asp.net web application can be told to capture all kinds of diagnostic information on the fly. In your web.config add <system.web> <trace enabled="true"/> Then localhost//trace.axd will function. However it doesn't capture any calls you make in your code to System.Diagnostics.Trace. Here's the code as configuration method to hook the two together: In Global.asax
      var gbTraceListener = new WebPageTraceListener();
      System.Diagnostics.Trace.Listeners.Add(gbTraceListener);
More information at http://msdn.microsoft.com/en-us/library/b0ectfxd(v=vs.100).aspx

No comments:

Post a Comment