Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Oct 10, 2002

Debugging Variables Made Easy


At one time or another, all ASP progrmmers have used RESPONSE.WRITE to write out a variable on the screen, ensuring that the variable is passing correctly or has the correct value. Then, when the page goes live, you have to go back and comment out or delete all those RESPONSE.WRITEs.

I have found a way to display your variables with only one line change.

At the top of your ASP page add the following line:
 
CONST DEBUG_MODE = False

Then, anywhere you need to display a variable, add.
 
If DEBUG_MODE then
  RESPONSE.WRITE "MyVar = " & MyVar & "<br>"
  ' add more if needed
End If

The Above code says If DEBUG_MODE is TRUE then display "MyVar" (change MYVAR to the name of your variable). Whenever you want to show your variables, go back to the top of the page and set DEBUG_MODE to True:
 
CONST DEBUG_MODE = True

Save the page and reload it in the browser. Your variables will be displayed. Once you're done debugging, set DEBUG_MODE back to False and be done with it.

Hope this tip helps someone. Please give feedback to putrtek@hotmail.com.
Mark Buckley
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap