I use
OutputDebugString (ODS) a lot when trying to trace through a problem with an application. Coupled with using
DebugView from SysInternals, you can easily get a real good idea of where things are going wrong.
In .NET, you use Debug.WriteLine() to write ODS messages. This requires that your assemblies be built with DEBUG information to see the ODS messages. When working with ASP.NET pages, you have a some options to achieve this (the easiest couple are listed here):
- Include the Debug attribute in the Page tag for the aspx page. For example:
<%@ Page language="c#" Debug="true"%>
Testing:<br>
<%
System.Diagnostics.Debug.Write("Testing");
%>
- Include the debug attribute in the web.config file. For example, put this in a section underneath the <configuration> node. You can also do this by changing the config file when running the IIS Manager, selecting Properties for the Virtual Directory, going to the ASP.NET page, selecting Edit Configuration, going to the Application tab, and selecting Enable Debugging.
<system.web>
<compilation debug="true" defaultLanguage="c#" />
</system.web>