TraceSection Class

Configures the ASP.NET code-tracing service.

Syntax

class TraceSection : ConfigurationSection  

Methods

The following table lists the methods exposed by the TraceSection class.

Name Description
GetAllowDefinition (Inherited from ConfigurationSection.)
GetAllowLocation (Inherited from ConfigurationSection.)
RevertToParent (Inherited from ConfigurationSection.)
SetAllowDefinition (Inherited from ConfigurationSection.)
SetAllowLocation (Inherited from ConfigurationSection.)

Properties

The following table lists the properties exposed by the TraceSection class.

Name Description
Enabled An optional read/write boolean value. true if tracing is enabled for an ASP.NET application; otherwise, false. The default is false.

When tracing is enabled, you can view the logged errors with the Trace.axd viewer at the URL http://<servername>/<applicationroot>/trace.axd. You must set the Enabled property to true to use the viewer. Note: Trace.axd is added to the <httpHandlers> section in the Applicationhost.config file by default.
LocalOnly An optional read/write boolean value. true if the trace viewer (Trace.axd) is available only on the host Web server; false if the trace viewer is available from any computer. The default is true.
Location (Inherited from ConfigurationSection.) A key property.
MostRecent An optional read/write boolean value. true if the trace store continues to collect the most recent trace messages and begins to discard older trace messages when the limit specified in RequestLimit is reached; false if the trace store stops collecting trace messages when the number specified in RequestLimit is reached. The default is false. Note: This property is new in the .NET Framework 2.0.
PageOutput An optional read/write boolean value. true if tracing information is added to the bottom of each Web page; false if trace output is accessible through the trace utility only. The default is false. Note: For more information about the ASP.NET trace viewer utility, see How to: View ASP.NET Trace Information with the Trace Viewer.
Path (Inherited from ConfigurationSection.) A key property.
RequestLimit An optional read/write sint32 value that specifies the number of trace requests, from 0 through 10000, to store on the server. The default is 10. If the limit is reached and the MostRecent property is false, tracing stops. Note: Although integer values in the range 0 to 2147483647 are accepted for the RequestLimit property, if you specify a value greater than 10000, ASP.NET silently rounds it down to 10000.
SectionInformation (Inherited from ConfigurationSection.)
TraceMode An optional read/write sint32 value that specifies the order in which trace information is displayed. The possible values are listed later in the Remarks section.
WriteToDiagnosticsTrace An optional read/write boolean value. true if ASP.NET trace messages are forwarded to the System.Diagnostics tracing infrastructure for listeners that are registered to display trace messages; otherwise, false. The default is false. Note: This property is new in the .NET Framework 2.0.

Subclasses

This class contains no subclasses.

Remarks

The following table lists the possible values for the TraceMode property. The default is 1 (SortByTime).

Value Keyword Description
1 SortByTime Specifies that trace information is displayed in the order that it is processed.
2 SortByCategory Specifies that trace information is displayed alphabetically by user-defined categories specified in the System.Web.TraceContext.Warn and System.Web.TraceContext.Write method calls in page or server control code.

Inheritance Hierarchy

ConfigurationSection

TraceSection

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

System.Web.TraceContext ConfigurationSection Class
trace Element (ASP.NET Settings Schema)
How to: Enable Tracing for an ASP.NET Page
System.Web.TraceContext Methods