Tracing in ASP.Net Custom Components

In Custom Components, you can use tracing if you reference the System.Web namespace and use the HttpContext.Current object to get a reference to the current context. Eg:

System.Web.HttpContext.Current.Trace("Application Trace Message", "Message");


Set the following directives:

For Page Level Tracing set Page Directive as

<%@ Page Trace="true" %>


For Application Level Tracing modify corresponding web.config as

<configuration>
<system.web>
<trace enabled="true" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true" />
</system.web>
</configuration>
Tags: , ,
Hot on Web:


About author