views:

683

answers:

3

I just downloaded Notepad++ because I need to work on a classic asp project. I'm a complete beginner with classic asp, and have been spoiled with asp.net and visual studio. I noticed Notepad++ has debug points you can place beside the line numbers. Is there a way I can step through asp script code using those?

If not what is the best / easiest way to debug asp classic scripts?

Thanks

A: 

Response.write is the way most devs did it back in the day. I actually made "cout" and "dout" functions . . . cout was just Response.write but dout checked to see if I was logged in and then wrote out a new line and then the value that's passed in.

tooshel
+1  A: 

Well if you have a copy of Visual Studio then the best way to debug (and code) an ASP Classic project is to use Visual Studio.

If you don't have Visual Studio then carry on editing in Notepad++ but use Windows Script Debugger (free download from MS) to perform debugging. You can attach to process running your ASP code and place break points in the script debugger. Alternatively place Stop commands in your VBScript code (or debugger if you are using JScript) and then choose Script Debugger from the available debuggers list.

Note you need to tweak the application configuration properties in IIS for the ASP application to allow debugging.

AnthonyWJones
Just tried Windows Script Debugger and it didn't work too well. I couldn't debug anything. It seems this is quite outdated.
chobo
You did enable debugging in the ASP Application configuration settings?
AnthonyWJones
+2  A: 

As a suggestion: if you are a beginning asp-developer, don't forget to put

 <% Option Explicit %>

at the beginning of every page.

This might save you countless hours of searching/debugging why certain code doesn't work.

Sorry, if I'm stating the obvious.

UPDATE: if you would consider just plain response.write's to the web page:

I have written an include file with a whole bunch of classic asp debug routines, which will all use response.write to output strings to the web page (formatted in a specific recognizable foreground and background colour), but which will all test a global variable 'ASPLIB_DeployStatus' (which can be set to 'adsDeployed', 'adsDeliveredDebug', 'adsInDevelopment' or 'adsInDevelopmentDebug'.

Depending on the value of this global value the debug texts will or will not be written to the web page. Meaning you can leave your debug statements in your source code, but make them disappear from the web page just be setting the global variable to another value.

This has helped me a lot and saves me considerable time.

If anyone should be interested respond via comments to this answer.

Edelcom
That's what I feared :) Response.write it is. Could you send me a copy of your debug routines. Thanks!
chobo
No, problem. Where can I find your email address ?
Edelcom
@chobo: Youy do need me to show your email address somehow, if you want me to email you the debug routines.
Edelcom
@chobo: If you are still interested in the debug routines drop me an email at info at edelcom dot be.
Edelcom