WebPageTraceListener Class

 

Provides a listener that directs Trace messages to ASP.NET Web page outputs.

Namespace:   System.Web
Assembly:  System.Web (in System.Web.dll)

System::Object
  System::MarshalByRefObject
    System.Diagnostics::TraceListener
      System.Web::WebPageTraceListener

[HostProtectionAttribute(SecurityAction::LinkDemand, Synchronization = true)]
public ref class WebPageTraceListener : TraceListener

NameDescription
System_CAPS_pubmethodWebPageTraceListener()

Initializes a new instance of the WebPageTraceListener class.

NameDescription
System_CAPS_pubpropertyAttributes

Gets the custom trace listener attributes defined in the application configuration file.(Inherited from TraceListener.)

System_CAPS_pubpropertyFilter

Gets and sets the trace filter for the trace listener.(Inherited from TraceListener.)

System_CAPS_pubpropertyIndentLevel

Gets or sets the indent level.(Inherited from TraceListener.)

System_CAPS_pubpropertyIndentSize

Gets or sets the number of spaces in an indent.(Inherited from TraceListener.)

System_CAPS_pubpropertyIsThreadSafe

Gets a value indicating whether the trace listener is thread safe. (Inherited from TraceListener.)

System_CAPS_pubpropertyName

Gets or sets a name for this TraceListener.(Inherited from TraceListener.)

System_CAPS_protpropertyNeedIndent

Gets or sets a value indicating whether to indent the output.(Inherited from TraceListener.)

System_CAPS_pubpropertyTraceOutputOptions

Gets or sets the trace output options.(Inherited from TraceListener.)

NameDescription
System_CAPS_pubmethodClose()

When overridden in a derived class, closes the output stream so it no longer receives tracing or debugging output.(Inherited from TraceListener.)

System_CAPS_pubmethodCreateObjRef(Type^)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the TraceListener.(Inherited from TraceListener.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the TraceListener and optionally releases the managed resources.(Inherited from TraceListener.)

System_CAPS_pubmethodEquals(Object^)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_pubmethodFail(String^)

Emits an error message to the listener you create when you implement the TraceListener class.(Inherited from TraceListener.)

System_CAPS_pubmethodFail(String^, String^)

Emits an error message and a detailed error message to the listener you create when you implement the TraceListener class.(Inherited from TraceListener.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodFlush()

When overridden in a derived class, flushes the output buffer.(Inherited from TraceListener.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetSupportedAttributes()

Gets the custom attributes supported by the trace listener.(Inherited from TraceListener.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

System_CAPS_pubmethodTraceData(TraceEventCache^, String^, TraceEventType, Int32, Object^)

Writes trace information, a data object and event information to the listener specific output.(Inherited from TraceListener.)

System_CAPS_pubmethodTraceData(TraceEventCache^, String^, TraceEventType, Int32, array<Object^>^)

Writes trace information, an array of data objects and event information to the listener specific output.(Inherited from TraceListener.)

System_CAPS_pubmethodTraceEvent(TraceEventCache^, String^, TraceEventType, Int32)

Writes trace and event information to the listener specific output.(Inherited from TraceListener.)

System_CAPS_pubmethodTraceEvent(TraceEventCache^, String^, TraceEventType, Int32, String^)

Writes an event message to a Web page or to the ASP.NET trace viewer using the specified system and event data.(Overrides TraceListener::TraceEvent(TraceEventCache^, String^, TraceEventType, Int32, String^).)

System_CAPS_pubmethodTraceEvent(TraceEventCache^, String^, TraceEventType, Int32, String^, array<Object^>^)

Writes a localized event message to a Web page or to the ASP.NET trace viewer using the specified system and event data.(Overrides TraceListener::TraceEvent(TraceEventCache^, String^, TraceEventType, Int32, String^, array<Object^>^).)

System_CAPS_pubmethodTraceTransfer(TraceEventCache^, String^, Int32, String^, Guid)

Writes trace information, a message, a related activity identity and event information to the listener specific output.(Inherited from TraceListener.)

System_CAPS_pubmethodWrite(Object^)

Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class.(Inherited from TraceListener.)

System_CAPS_pubmethodWrite(Object^, String^)

Writes a category name and the value of the object's ToString method to the listener you create when you implement the TraceListener class.(Inherited from TraceListener.)

System_CAPS_pubmethodWrite(String^)

Writes a message to a Web page or to the ASP.NET trace viewer.(Overrides TraceListener::Write(String^).)

System_CAPS_pubmethodWrite(String^, String^)

Writes a category name and a message to a Web page or to the ASP.NET trace viewer.(Overrides TraceListener::Write(String^, String^).)

System_CAPS_protmethodWriteIndent()

Writes the indent to the listener you create when you implement this class, and resets the NeedIndent property to false.(Inherited from TraceListener.)

System_CAPS_pubmethodWriteLine(Object^)

Writes the value of the object's ToString method to the listener you create when you implement the TraceListener class, followed by a line terminator.(Inherited from TraceListener.)

System_CAPS_pubmethodWriteLine(Object^, String^)

Writes a category name and the value of the object's ToString method to the listener you create when you implement the TraceListener class, followed by a line terminator.(Inherited from TraceListener.)

System_CAPS_pubmethodWriteLine(String^)

Writes a message to a Web page or to the ASP.NET trace viewer.(Overrides TraceListener::WriteLine(String^).)

System_CAPS_pubmethodWriteLine(String^, String^)

Writes a category name and a message to a Web page or to the ASP.NET trace viewer.(Overrides TraceListener::WriteLine(String^, String^).)

System_CAPS_noteNote

The HostProtectionAttribute attribute applied to this class has the following Resources property value: Synchronization. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

The WebPageTraceListener class forwards trace messages that are written to the Trace log to ASP.NET Web page output channels. You can enable trace forwarding by adding a WebPageTraceListener object to your Web.config file as a listener in the trace Element (ASP.NET Settings Schema) subsection of the <system.diagnostics> Element section. You can also add a WebPageTraceListener to the listeners collection programmatically. Commonly, this is done by adding a WebPageTraceListener to the collection during application startup, using the Application_Start method in the Global.asax file.

The following code example demonstrates how to route Trace messages to Web form output. The code example shows a typical Web form containing a BulletedList and AccessDataSource control. Tracing is enabled on the Web form and trace output is appended to the Web form when it is rendered. You can examine the trace messages in the Trace Information table of the trace output. If you have enabled the WebPageTraceListener correctly in your configuration file, you see both trace messages with the category "Trace Test". However, if you have not enabled the WebPageTraceListener, you see only the trace message that is written to the TraceContext object.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: