Library code snippets
Plan for debugging
As everyone knows, Active Server Pages doesn't have the best debugging
capabilities out of the box, but there are several techniques you can
implement yourself that will help you with debugging down the line.
One we've found that works well is to use a simple session variable to
keep track of whether you're in "debug mode" or not. Add the following
code to the first page of your application:
if request("debug") <> "" then
session("debug") = "true"
end if
Then, in subsequent pages of your application, you can interrogate the
value of this session variable to determine whether you should execute
all those response.write's and similar debugging code, like this:
if session("debug") = "true" then
response.write "Variable strUser is " & strUser
response.write "Variable intLoop is " & intLoop
response.write "The SQL we're executing is " & strSQL
'And so on
else
'Just do it!
end if
When it's time to run your application in debug mode, simply invoke the
page with the QueryString "?debug=something" in your URL, like this:
http://localhost/mycoolapp.asp?debug=on
When this QueryString value is left out, the application will run in
production mode, that is, without executing all your debug code.
Related articles
Related discussion
-
Help to Call ASP function from onclick event in HTML to pass an array
by vka (0 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Variable In Vb.Net
by chia (0 replies)
-
ideas in building a captive portal
by sjranjan (2 replies)
-
How to debug classic ASP pages during AJAX calls in ASP.NET website
by andwan0 (0 replies)
Related podcasts
-
Scott Guthrie
Scott catches up with Scott Guthrie in an interview covering Ajax, Asp 2.0, extender controls, CSS adapters and more.
This thread is for discussions of Plan for debugging.