TraceContext Class
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Captures and presents execution details about a Web request. This class cannot be inherited.
public ref class TraceContext sealed
public sealed class TraceContext
type TraceContext = class
Public NotInheritable Class TraceContext
- Inheritance
-
TraceContext
You can use this class to append messages to specific trace categories. For example, if you are creating an instance of the Calendar class for your application, you might include the trace message "Starting To Render" in a rendering procedure, and "Raising OnChange Event" in an event handler procedure.
You can also use the TraceContext class to obtain a set of trace records at the end of request execution for custom processing. For more information, see ASP.NET Tracing Overview.
To enable tracing, set the Trace
attribute in the @ Page directive or the IsEnabled property to true
. When tracing is enabled, in addition to showing user-provided trace content, the Page class automatically includes performance data, control-tree structure information, and state management content for every request.
Trace |
Initializes a new instance of the TraceContext class. |
Is |
Gets or sets a value indicating whether tracing is enabled for the current Web request. |
Trace |
Gets or sets the sorted order in which trace messages should be output to a requesting browser. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get |
Serves as the default hash function. (Inherited from Object) |
Get |
Gets the Type of the current instance. (Inherited from Object) |
Memberwise |
Creates a shallow copy of the current Object. (Inherited from Object) |
To |
Returns a string that represents the current object. (Inherited from Object) |
Warn(String, String, Exception) |
Writes trace information to the trace log, including any user-defined categories, trace messages, and error information. All warnings appear in the log as red text. |
Warn(String, String) |
Writes trace information to the trace log, including any user-defined categories and trace messages. All warnings appear in the log as red text. |
Warn(String) |
Writes a trace message to the trace log. All warnings appear in the log as red text. |
Write(String, String, Exception) |
Writes trace information to the trace log, including any user-defined categories, trace messages, and error information. |
Write(String, String) |
Writes trace information to the trace log, including a message and any user-defined categories. |
Write(String) |
Writes a trace message to the trace log. |
Trace |
Raised by the TraceContext object to expose trace messages after all request information is gathered. |
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: