Setting Trace Messages

The TraceContext class has a fairly simple interface, with only one constructor, two properties, and two methods. Of course, these are in addition to the standard properties and methods inherited from the Object class. An instance of the TraceContext class is available to your ASP.NET pages through the Trace property of the Page object, so you will need the constructor only if you want to enable tracing in your .NET components (discussed later in this chapter).

TraceContext Properties

The IsEnabled property works the same way as the Trace attribute of the @Page directive. The nice part about having this property available to you is that, unlike the @Page directive, it can be dynamically assigned. For instance, you can ...

Get Debugging ASP.NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.