Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software

Trace.Write from Custom Web Control

I am trying to develop a custom (actually, a composite) web control.  I have the control embedded with a harness web page, with trace turned on.  Even though I have lots of "Trace.write" statements liberally interspersed throughout both the harness code behind page and the custom control code, I only get trace output from the harness page, not from the control's code.

Any help?

Ken Ray
Thursday, April 21, 2005

URL rewriting is so lame.

The Url ReWriter
Friday, April 22, 2005

Sounds like you're using System.Diagnostics.Trace in the control, and Page.Trace in your harness web page (which, like HttpContext.Current.Trace, is a reference to a System.Web.TraceContext object).

It sounds like you want to use the System.Web.TraceContext object: you can reference it from your control as:
- this.Page.Trace
- System.Web.HttpContext.Current.Trace

Depending on where you're calling it, you may want to check if this.Page or System.Web.HttpContext.Current is null before referencing it.

Friday, April 22, 2005

Thanks Joe, that solved the problem.

Ken Ray
Friday, April 22, 2005

*  Recent Topics

*  Fog Creek Home