You can configure individual pages to display trace information. Alternatively, you can configure the application's Web.config file so that all pages display trace information unless the page explicitly disables tracing. Setting application-level tracing is useful because you do not need to make changes to individual pages to enable and disable it.
You enable application-level tracing using the
Note |
---|
When you enable tracing for an entire application in the Web.config file, trace information is gathered and processed for each page in that application. To override the application-wide settings, set the Trace attribute in that page's |
Viewing Trace Information
As with page tracing generally, you can view trace information at the bottom of individual pages. Alternatively, you can use the trace viewer (Trace.axd) to view trace information collected and cached by ASP.NET when tracing is enabled.
If you want trace information to appear at the end of the page that it is associated with, you can set the trace element's
By default, application-level tracing can be viewed only on the local Web server computer. To make application-level trace information visible from remote computers, you can set the trace element's
Note |
---|
To help keep your Web application secure, use the remote tracing capability only when you are developing or deploying your application. Be sure to disable it before you transfer your application to production Web servers by setting LocalOnly attribute to true in the Web.config file. |
The following example shows an application trace configuration that collects trace information for up to 40 requests and allows browsers on computers other than the server to display the trace viewer.
В | Copy Code |
---|---|
<configuration> <system.web> <trace enabled="true" requestLimit="40" localOnly="false" /> </system.web> </configuration> |
Trace Configuration Attributes
The following table shows the attributes you can use to modify the behavior of application-level tracing in the
Attribute | Description | ||
---|---|---|---|
|
true to enable tracing for the application; otherwise, false. The default is false. You can override this setting for individual pages by setting the Trace attribute in those pages' |
||
|
true to display trace both in pages and in the trace viewer (Trace.axd); otherwise, false. The default is false.
|
||
|
The number of trace requests to store on the server. The default is 10. |
||
|
The order in which trace information is displayed. Set to |
||
|
true to make the trace viewer (Trace.axd) available only on the host Web server; otherwise, false. The default is true. |
||
|
true to display the most recent trace information as tracing output; otherwise, false, which indicates that once the requestLimit value is exceeded, new requests are not stored. The default is false.
|