How to use debug points?

断了今生、忘了曾经 提交于 2019-12-14 01:28:49

问题


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


回答1:


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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/2053583/how-to-use-debug-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!