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
-
Header and Footer in Web page print
by fhajaj (4 replies)
-
help me to get simple requirement
by Slicksim (1 replies)
-
Gridview -> Template Field -> Button
by antti.simonen (1 replies)
-
Classic ASP : Page expires
by chezhian_in05 (0 replies)
-
ASP VS PHP
by paulfp (9 replies)
Related podcasts
-
ASP.NET Caching and Performance
Steve Smith, owner of ASP Alliance and Lake Quincy Media joins us today to teach us about some hidden gems in ASP.NET caching and performance. Steve’s expertise in this area comes from first-hand experience as Lake Quincy’s ad system serves over 60 requests per second and handles over 150 million...
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum) -
Microsoft Dynamics CRM Technical Consultant
in Netherlands (€50K-€90K per annum) -
Technical Support Engineer EMEA
in Reading (£50K-£50K per annum) -
Solutions Engineer
in Reading (£50K-£60K per annum)
This thread is for discussions of Plan for debugging.