Debugging

Rather than printing comments to your pages or using other jury-rigged debugging, you can use ASP.NET's built-in debugging features.

System.Trace

The System.Trace class allows you to output both information and warnings, depending on the situation, using Trace.write() and Trace.warn(). You can combine these with exception handling to provide extensive debugging information.

 <%@ Page Language="VB" Trace="True" %> <script runat="server" language="VB"> Function Savings (price as Double, discount as Double) as Double if TraceContext.isEnabled then Response.write "<!-- Tracing enabled. Sort mode is " & _ TraceConect.TraceMode&"-->" else Response.write "<!-- Tracing disabled. -->" end if dim temp as Double try Trace.write("SavingsCategory", ...

Get ASP.NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.