ASP.NET Application - Tracing Doesn't Work

R

rehto

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_TraceFile.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");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,991
Messages
2,570,212
Members
46,800
Latest member
Tobi1987

Latest Threads

Top