You can control whether tracing is enabled or disabled for individual pages. If tracing is enabled, when the page is requested, ASP.NET appends to the page a series of tables containing execution details about the page request. Tracing is disabled by default.
To enable tracing for a page
Include an directive at the top of your .aspx file.
Add a Trace attribute and set its value to true, as shown in the following example:
В Copy Code
<%@ Page Trace="true" %>
When tracing is enabled for a page, trace information is displayed in any browser requests that page. Tracing displays sensitive information, such as the values of server variables, and can therefore represent a security threat. Be sure to disable page tracing before porting your application to a production server. You can do this by setting the Trace attribute to false or by removing it. You can also configure tracing in the Web.config file by setting the enabled, localOnly, and pageOutput attributes of the . The Trace attribute in the directive takes precedence over attributes set in the element in the Web.config file. Therefore, even if you disable tracing in the Web.config file by setting the enabled attribute to false, the page might still show tracing information if the Trace attribute in its directive is set to true.
Optionally, include the TraceMode attribute to specify the order in which you want your trace messages to appear:
Set TraceMode to to sort trace messages in the order in which they are processed.
Set TraceMode to to sort trace messages by the categories that you specified in the and method calls in your page or server control code.
The following example shows how to enable tracing in a page and to sort trace messages by category.
В Copy Code
<%@ Page Language="VB" Trace="True" TraceMode="SortByCategory" %>