Does ASP.NET Tracing work in MVC2 Views?
        Posted  
        
            by AUSTX_RJL
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by AUSTX_RJL
        
        
        
        Published on 2010-04-29T14:25:42Z
        Indexed on 
            2010/06/15
            19:02 UTC
        
        
        Read the original article
        Hit count: 278
        
I have a VS 2010 MVC2 .NET 4.0 web application. ASP.NET tracing is enabled both in the Page directive (Trace="true) and in the Web.config:
<trace enabled="true" 
       requestLimit="10"
       pageOutput="true"
       traceMode="SortByTime" 
       localOnly="true" 
       writeToDiagnosticsTrace="true"
       />
A standard trace listener is also configured in the Web.config:
<trace autoflush="true" indentsize="4">
  <listeners>
    <add name="WebPageTrace" type="System.Web.WebPageTraceListener, System.Web, Version=4.0.30319.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <add name="TextWriterTrace" type="System.Diagnostics.TextWriterTraceListener" initializeData="textListener.log" />
  </listeners> 
</trace>
Tracing works fine from the controller, but when I add a Trace in the View (.aspx) nothing ever shows:
<% System.Diagnostics.Trace.WriteLine("Message System.Diagnostics.Trace from View"); %>
<% Page.Trace.Write("Message Page.Trace from View"); %>
Is this supposed to work? Is there something else that is needed to enable Tracing from a View?
Thanks
© Stack Overflow or respective owner