How can I set breakpoints in Classic ASP? (IIS7/VS2010)

11,321

Solution 1

In VBScript, the Stop statement can be used to trigger a breakpoint.

Response.Write "a line"
Stop
Response.Write "a line after the breakpoint

I'm assuming that this is a local IIS7 instance that you want to debug. On my computer, when I try to load a sample page that has a Stop statement, I get the Visual Studio Just-In-Time Debugger popup. You will need to provide administrative privileges in order to debug the page.

You may also need to enable server-side debugging in the "ASP" applet in IIS Manager, but when I checked just now, server-side debugging was set to False on my machine.


If you don't mind running Visual Studio with admin privileges (or already do), then you can also try the following:

  1. Use the "File -> Open Web Site..." command to open the site (under the "Local IIS" section).
  2. From the Solution Explorer, open the files you want to debug and set breakpoints.
  3. Start the debugger by selecting the "Debug -> Attach to Process..." menu item. Select the "w3wp.exe" process.
  4. Now when you try to load a page in your browser, Visual Studio will stop at any breakpoints.

Also note that if you make changes to the pages, the changes will be saved to disk. At work, I use VS2005 this way as my main editor for classic ASP, precisely because I can set breakpoints easily.


A third option that I haven't tried yet might be the recently released IIS Express. It's supposed to be designed specifically for developers who don't have full admin privileges, so maybe debugging won't require an elevation prompt. I'll update my answer if I get a chance to try it out in the next few days.

Solution 2

response.write("my value....")
response.end
;)
Share:
11,321
3Dave
Author by

3Dave

Sr. Software Dev at Unity. Graphics, games and GPGPU coder. EE, sometimes quasi-professor, amateur racer. My car is always in pieces.

Updated on June 04, 2022

Comments

  • 3Dave
    3Dave about 2 years

    I have a hybrid ASP.NET/classic ASP application and I'd like to be able to set breakpoints in the ASP code. Is this possible? Running IIS7 on Win7 with VS2010 Ultimate.

  • 3Dave
    3Dave over 13 years
    Yeah... that's pretty obvious, and doesn't really answer my question. I'm looking for a way to actually set breakpoints. Throwing response.write() into hundreds of thousands of lines of classic ASP in order to track down a bug is not fun.
  • 3Dave
    3Dave over 13 years
    Hard to believe that after 15+ years I've never heard of "stop." thanks for the detailed response; I'll try this out later today. Already have to run VS as admin to debug with IIS, so that's not a big deal.
  • 3Dave
    3Dave over 13 years
    Btw, I would swap your comment with your answer as its more informative, and its good practice to quote the relevant part of the article that you're linking to in case the reference dies in the future.
  • Rich
    Rich over 11 years
    +1 for mention of attach to w3wp.exe. I was trying to attach to inetinfo.exe as I'm sure I used to in Win Xp. Thanks, good answer.
  • 3Dave
    3Dave over 8 years
    Welcome to StackOverflow! If you're not answering the existing question, open a new question.