New Realm of Trace.axd-asp.net debugging

Source: Internet
Author: User

In the past, we often used Response in the page to debug a variable. write outputs a string to verify whether the web program runs here and whether the variables are obtained correctly. Some people will also call the encapsulated js framework, alert or msgbox, with a piece of information. This is the most common method in the asp era. If you want to debug complex information, this method seems a little powerless.

However, after entering the asp.net environment, we can completely forget this method. Because Microsoft provides us with a new solution-Trace. axd

For official instructions on Trace. axd, see MSDN: http://msdn.microsoft.com/zh-cn/library/6915t83k%28VS.80%29.aspx

Its function is mainly to configure ASP. NET code tracking service to control how to collect, store, and display tracing results.

Key options:
1. localOnlyThe default value is false. This is easy to understand. If it is true, only trace information is output locally.

2,Enabled. Whether to enable tracing.

3,PageOutputSpecifies whether trace output is displayed at the end of each page. If yesFalse, You can only access the trace output through the tracking utility.

4,RequestLimitSpecifies the number of Trace Requests stored on the server. The maximum is 10000. The default value is 10.

5,TraceModeSpecifies the sequence in which the trace information is displayed.SortByCategory orSortByTime (default)

Note that:

If Tracing for an application is enabled, whenRequest any pageThis page collects tracing information and executesArbitrary trackingStatement. You can view the Trace Output in the trail viewer. With the tracking viewer, you can select a specific request from the application request page.

Let's look at a simple example:

In the Vs2005/2008/vs2010 environment, create a Web Appication. On the default page, add simple labels, TextBox, And Button to submit a simple request. The effect is as follows:

The corresponding web. config is as follows:

 <?xml version="1.0" encoding="utf-8"?>

<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<trace enabled="true"
localOnly="true"
pageOutput="true"
requestLimit="15"
mostRecent="true" />
<compilation debug="true" />
<authentication mode="Windows" />
</system.web>
</configuration>

Reference:
Http://msdn.microsoft.com/zh-cn/library/6915t83k%28VS.80%29.aspx

In addition, you can use httpwatch for more professional debugging tools.
Http://www.httpwatch.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.