ASP Debugging Guideline
By: Adrian Lanning
Original Edition: 05 / 04 / 03
Last Changed: 08 / 05 / 03
Email: alanning55@hotmail.com
Ok, you’ve created this nifty ASP
page but when you try to view it, something doesn’t work. What are you going to
do?
Here’s some suggestions of where to
start from somebody who’s spent quite a few lifetimes debugging his own code…
(PS. These suggestions assume VBScript as the scripting language in use but they should be applicable to JavaScript as well.)
Zack Halbrecht has some great suggestions for improving ASP debugging! Here are his tips:
-
Add Option Explicit to the top of your ASP Code. Be it in a header
file or just at the top of a page, it will make debugging much much
easier. It amazes me how many new ASP developers don't know about
this. It enforces the good practice of making sure your variables are
dimmed and complains if you mistakenly dim a variable more than once.
- If you're using classic ASP (not .NET) and using IE as your
testing/debugging tool, make sure you have the
'Show Friendly HTTP Error Messages'
option unchecked in IE
Tools -> Internet Options -> Advanced Tab
That way IE won't hide the specifics of what the 500 error is. It will
actually give you a reason, file, and line number to inspect.
-
Sometimes it will appear that this error message is not showing up,
but often times this is caused by the error occurring in a section of
the page that has not had a chance to render. (Code execution was
broken by error before valid HTML was written to the client)
To view the error, view the source of the page and scroll to the
bottom of the source code to identify what went wrong.