The web.config file includes a
<trace ...> section that is used to set up tracing options
for an ASP.NET application. A typical trace section follows:
<trace
enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true"
/>
This example demonstrates all of the fields available to modify application tracing.The
first field controls whether tracing is enabled.This defaults to false and can be overridden
at the individual page level.The second item, requestLimit, controls how many
requests' trace results should be stored on the server. Once filled, this queue will not
accept new entries until the queue is deleted (which can be done from the trace.axd
page).The third attribute, pageOutput, controls whether trace output should be displayed
on every page in the application.When set to false, trace output is available only from
the trace.axd URL (for example, http://mydomain/myapplication/trace.axd).
Individual pages can override this setting by explicitly setting trace="true" or
trace="false" in their page directive.
The fourth attribute, traceMode, simply controls the ordering of the trace messages in
the Trace Information section of the trace output.The allowable options are SortByTime
(the default) and SortByCategory. Finally, the last attribute, localOnly, enables application
tracing only for requests originating from the local machine when set to true. Note
that these items are case-sensitive.
Comments
Tracing can provide a powerful way to debug applications. By using the trace.axd URL
for trace output, developers can pull important details about a production ASP.NET
application without interfering with current users. However, be careful that you do not
place sensitive information in trace statements or collections that are exposed by the
trace output (Application, Session, Forms, Cookies, QueryString, and so on), because by
default anybody can access the trace.axd URL and access this data. Note that you can
change the name of the trace.axd file by changing its name in the machine.config file.
No comments:
Post a Comment