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
-
Calling a function from ASP code
by dunk00 (3 replies)
-
GridView HyperLinkField Problem
by Paul2 (0 replies)
-
looking for help on asp
by cladironbeard (2 replies)
-
simple vb to c#, help please
by lksath (1 replies)
-
Binary Studio | software development outsourcing Ukraine
by Hexfinity (2 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.
Events coming up
-
Aug
27
Model-View-Presenter (MVC) in ASP.NET
San Francisco, United States
Model-View-Presenter (MVC) in ASP.NET Presenter Clayton Peddy, Terrace Software, Inc. Details TBD
This thread is for discussions of Plan for debugging.