1. What is "tracking"
Tracking is a way to monitor the execution of an application when it is running. When developing a. NET application, you can add the tracking and debugging detection function in it, and use this detection function when developing the application and deploying the application. The Trace and Debug classes allow you to record information about errors and application execution to logs, text files, or other devices for subsequent analysis.
2. Why use tracking?
In the asp era, if you need to understand certain States and variable values of a program during runtime, the Response. Write is usually used on the page for output. The vast majority of the reasons for doing so are caused by the weak operating and development environment of asp. The result is that the output on the page may cause page chaos, not to mention the Response added to the program. write is not easy to manage. Once there are any omissions, it will cause unnecessary misunderstanding to the customer.
The tracking function of ASP. NET not only tracks the state and variable value of the program at all stages of the program running, but also supports various management functions supported by ASP. NET. It can be displayed along with the Aspx page, or in another place in a special way. As far as I know, it has the following advantages:
1. You can manage the entire website in a unified manner or start it on a single page. By configuring web. config, you can enable tracking for the entire website or use it on the page.
2. The page layout and presentation are not affected.
3. fully reflect the status of cookies and sessions. This is one of the reasons why I used tracking for the first time.
4. fully reflect the process and execution time of each page event.
3. Enable tracking on the page
1. Use Trace = "true" in <@ page>"
2. Add "Trace. IsEnabled = true;" to the code ;"
3. add your own tracking information:
Trace. Warn ("abc"); // Warn displays red information.
Trace. Write ("def"); // write displays normal color information.
4. Conflict with ASP. NET ajax after tracing is enabled
When page tracking is enabled on the page using UpdatePanel or full-site tracking is enabled, pageOutput = "true" causes Sys. WebForms. PageRequestManagerParserErrorException exceptions.
The reason is that there is Response. Write during page tracking.
The solution is pageOutput = "false" When page tracing or full-Site Tracing is not required ". Trace. axd is used to view trace information.
V. Performance
When tracking is enabled for a website, it must be of low performance.
However, adding custom tracing information on the page should have a slight impact on performance.
- Introduction to ASP. NET Framework
- Introduction to ASP. NET Applications
- Processing Methods of ASP. NET framework
- Analysis on ASP. NET Security Architecture
- Overview ASP. net mvc and FubuMVC core framework