(i). Description
Many people in the debugging input, general use: Respone.write (), or after tracking the command window to calculate the value of the object and other methods.
In fact, Microsoft provides good output Debug class trace for asp.net. Here's how it's used.
(ii) Specific use
Divided into page-level debugging and application-level tracing debugging:
1. Page-level tracking: Include the following page directives at the beginning of the page <%@ page trace= "True" tracemode= "Sortbycategory/sortbytime"%>
I. Custom Message Example:
Trace.Write ("Here is the variable or custom string to output the result");
Trace.Warn ("Here is the string to display"); Same as Trace.Write, except the font is red
Check if tracking is used
Ii. determine if trace output is enabled:
if (trace.isenabled) {Trace.Warn ("tracing Enabled")}
2. Application-level tracking:
<trace enabled= "true" pageoutput= "true" in the <System.Web> section of the web.config file/>
This does not have to be set on a single page.
The biggest benefit of tracing with trace is that when a programmer finishes using it, the page or application trace is set to: false.
You don't have to delete it or comment it. Because the compiler compiles to the trace output
Statement is not compiled, it skips the trace statement and continues to compile the following statement.
From a programmer's point of view, trace is equivalent to having commented out