【Abstract】 the tracking function of ASP. NET is much better than that of ASP. It is helpful to identify the root cause of errors in WEB applications through tracking information. This article explains in detail the tracking mode of ASP. NET through examples.
[Keyword] ASP. NET; Trace information; Trace
1. Introduction
The most common debugging method of ASP is to use Response. Write to set breakpoints and display the current values of some variables on the web page. However, this method has many problems.
(1) The program contains Response. Write statements, which may affect debugging and page layout.
(2) After the debugging is complete, delete these statements with pain points. When deleting redundant Response. Write statements, you must be careful to prevent the necessary Response. Write statements from being deleted by mistake. If there are hundreds of lines in the program, you can imagine the heavy workload.
ASP. NET introduces a new feature that allows you to write debugging statements directly in code, so that you do not need to remove the applications when deploying them to the production server. This function is called tracking. It allows you to write variables or structures on the page, determine whether the assertions meet certain conditions, or simply trace through the execution path of the page or application. To collect and display these messages and other tracing information, you must enable page or application tracing. When tracing is enabled, two things will happen:
(1) ASP. NET adds a series of diagnostic information tables to the output page. This information is also sent to the tracing Viewer application (only when tracing for the application is enabled ).
(2) ASP. NET displays custom diagnostic messages in the Trace Information table of append performance data. The specified diagnostic information and tracing message are appended to the page output sent to the requesting browser. Alternatively, you can view this information in a separate trace. axd, which displays the trace information for each page of a given application. When ASP. NET processes page requests, this information helps identify errors or unwanted results.
The trace statement is processed and displayed only after the trail is enabled. You can control whether to display a trail to a page, to a trace viewer, or to both a page and a trace viewer.
2. ASP. NET tracking mode configuration
To be able to use the tracing function, you must enable it within the page or the entire application.
2.1 page-level Configuration