Say goodbye to inline Response.Write
statements for debugging in ASP.NET! In addition to its built-in debugging capabilities, Visual Studio .NET also supports a new mechanism for run-time debugging, called page tracing.
To enable or disable page-level tracing, access the HTML code of your ASPX page. Modify the Page
statement to include:
<@ Trace="True" ...
Once the Trace
attribute is set, run your ASP.NET application and observe the results. At the bottom of your page output, you should see information, covering controls, cookies, server variables, sessions, and more. You'll also be able to use the Write
methods of the intrinsic Trace
object to output information to the browser. This information comes at the end of the page's normal output, with Warn
statements showing up in red. This simple directive can be extremely helpful in debugging pages, following the values of variables, seeing the ServerVariables
Note: Do not leave Tracing on in production environments.