System.Web.WebPageTraceListener Class

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

See Also: WebPageTraceListener Members


public class WebPageTraceListener : System.Diagnostics.TraceListener



The System.Security.Permissions.HostProtectionAttribute attribute applied to this class has the following System.Security.Permissions.HostProtectionAttribute.Resources property value: System.Security.Permissions.HostProtectionResource.Synchronization. The System.Security.Permissions.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 System.Security.Permissions.HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.

The System.Web.WebPageTraceListener class forwards trace messages that are written to the System.Diagnostics.Trace log to ASP.NET Web page output channels. You can enable trace forwarding by adding a System.Web.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 System.Web.WebPageTraceListener to the listeners collection programmatically. Commonly, this is done by adding a System.Web.WebPageTraceListener to the collection during application startup, using the Application_Start method in the Global.asax file.


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