How can I use Tracing in Custom Components?

Platform: ASP.NET| Category : Custom Controls, Error Handling

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.

VB.NET

System.Web.HttpContext.Current.Trace('xxx', 'Message')

C#

System.Web.HttpContext.Current.Trace('xxx', 'Message');

Also make sure to 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>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.