WebPageTraceListener

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've followed the directions in
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_aspnetcon/html/18b560f6-120b-462d-8e9f-0baf34c4919d.htm

but am not able to get trace output from the business object to the trace
displayed in the web page . It shows up in the vs2005 output window but I'd
like it interspersed with the trace from the page load as this article claims
to do .

Any Ideas ? Any more information needed ?
thanks
-chaz
 
Have you tried simply passing in an instance of the Page class into your
business object (possibly as a ctor overload) and simply calling
Page.Trace.Write?
Peter
 
Thanks for the sample . We were able to determine that the
System.Diagnostics.Trace.Write() that wasn't showing up was actually part of
a code path that exists during session_start .

simply ,
application_beginRequest was followed by Session_start (as no session
existed yet) which had a module that called System.Diagnostics.Trace.Write()
..
This diagnostic never made it to the page output presumably because the page
hadn't been created yet .

So this indicates that the earliest one can write to the trace and expect it
output to the webpage is during or after pre-init.
 
Hi,

Thanks for your update.

The reason that you didn't see System.Diagnostics.Trace.Write() output is
because the TraceContext.IsEnabled property is false in Session_Start. I
believe your Page's Trace is turned on but web.config wasn't. Therefore,
before Page is initialized, the IsEnabled property is reading from
web.config and by default it's false. So writing trace information at this
time will not be displayed.

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top