By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

ASP.NET Application - Tracing Doesn't Work

P: n/a
We have an ASP.NET 2.0 (C#) app and we want to enable tracing (see the code
snippets below).

The first time a user navigates to the app., the tracing works fine (the
ASP.NET tracing appears on the screen and writes to a text file). The
problem happens any subsequent time the app. is used--tracing doesn't
happen. It's as if tracing just turns itself off. So, we only get tracing
on the first time the app runs but never any other time.

Has anyone ever seen this?
What could we be doing wrong?
Any suggestions on how to fix?

Web.config
<system.web>
...
<trace enabled="true" pageOutput="true" writeToDiagnosticsTrace="true"/>
</system.web>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="WebPageTraceListener" type="System.Web.WebPageTraceListener,
System.Web, Version=2.0.3600.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
<add name="TextWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="D:\Temp\TraceFiles\Application_Tra ceFile.log"/>
</listeners>
</trace>
</system.diagnostics>

Default.aspx (no UI/no HTML, only code-behind)
protected void Page_Load(object sender, EventArgs e)
{
// Do some stuff
Trace.Write("category", "message");
Response.Redirect("Next.aspx", true);
}

Next.aspx (no UI/no HTML, only code-behind)
protected void Page_Load(object sender, EventArgs e)
{
// Do some stuff
Trace.Write("category", "message");
Response.Redirect("TheRealStartPage.aspx", true);
}

TheRealStartPage.aspx (this page has HTML and code-behind)
protected void Page_Load(object sender, EventArgs e)
{
// Do some stuff
Trace.Write("category", "message");
}

May 31 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.