Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can you debug ASP without a debugger?

Debugging ASP

How can you debug ASP without a debugger?

by  Wendell  Posted    (Edited  )
It's always best to have a debugger, the step into and step over fuctions, etc., server-side especially, are life savers. But, if you don't have one (for what ever reason) try saving the following code into a seperate file - with an asp or inc extension recommended - and simply <!--#Include File="the file name" //-->

<%
Dim bDebugging

Sub TraceStart()
bDebugging = True
DebugIt "Tracing started"
End Sub

Sub TraceStop()
DebugIt "Tracing stopped"
bDebugging = False
End Sub

Sub DebugIt( strString )
If bDebugging Then
Response.Write "Debugging: " & strString & "<br>"
End If
End Sub

Sub TraceProcedureStart( strProcedure )
DebugIt strProcedure & " started"
End Sub

Sub TraceProcedureEnd( strProcedure )
DebugIt strProcedure & " ended"
End Sub

Sub CheckError()
Response.Write "<br>Error Description is: " & Err.Description & ".<br>"
End Sub
%>

Then you can TraceStart(), and DebugIt"variable name = " & variable name, and TraceStop() {on seperate lines} to gain visiblity to what's going on at that point. Better yet, TraceStart() once at the start of the file, and TraceStop() at the end, then you can DebugIt" " as many times as you want - and if you don't want to comment each one out or delete them you can simply set bDebugging to False in TraceStart. Enjoy, Wendell
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top