7

OK, So I have recently moved into the world of Web development after spending quite a few years coding in a pretty simple proprietary language, and one of my first jobs is to tweak an old classic ASP page for one of our clients. I'm using Visual Studio 2008 to try debug some problems I am having, but the page won't load at all. If I browse the site locally using IIS, then everything works without any trouble at all, so I am not sure what I am doing wrong.

Here's the error message I get;

Compiler Error Message: BC30451: Name 'VariableName' is not declared.

The way this is setup, is that file1.asp has an include for file2.asp

<!-- #include file=./includes/file2.asp -->

Then file2.asp has a form post for file3.asp

<FORM METHOD="POST" ACTION="/includes/file3.asp">

Inside file3.asp is where the variable is created.

So, when running this site via IIS, everything works, the variables look to be passed between files without any trouble, but when I try to debug the site using VS2008, I get the BC30451 error code.

Can anyone right my ship? I've been doing a lot of googling and reading of other websites that seem to deal with this issue, but a lot of it is going over my head. If anyone could please take the time to explain what & why this is happening, as well as providing some kind of solution, or pointing me in the direction of somewhere that may be able to help, it would be more than greatly appreciated.

Cheers,

Pat.

2 Answers 2

7

You can debug classic ASP in Visual Studio 2008. The way to do it involves attaching the debugger to the process that is running your ASP pages. Keeping in mind that Classic ASP debugging only works with IIS; it does not work with the VS Development Web Server (Cassini). Also, make sure that you have enabled ASP debugging in IIS:

IIS Home Directory Properties http://img4.imageshack.us/img4/6431/capturert.png


IIS Application Configuration http://img26.imageshack.us/img26/4802/capture2qr.png

Once you have the configuration in IIS as noted above, here is how to attach the debugger:

  1. Open the Classic ASP files in Visual Studio
  2. Set a breakpoint anywhere you want to break in the server-side code
  3. View the page in a web browser (ensures that the host process is running)
  4. In Visual Studio: Debug Menu -> Attach to Process
  5. Locate the IIS ASP worker process (w3wp.exe on IIS6, dllhost.exe on IIS5.1)
  6. Attach to the script code for the host process (see below for example)

Attach Debugger Dialog http://img43.imageshack.us/img43/2218/capturegb.png

At this point, the breakpoint should bind and you should be able to debug the Classic ASP pages. (you may have to refresh the page in the web browser to get the code to execute again once the debugger has been attached)

3
  • Wonderful, that looks to have done the trick. I access the site via IIS, and then debug by attaching to the IIS process, rather than debugging using Cassini. I read a bit on this online but couldn't get my head around it...thanks for the clarity in your suggestion, it's most appreciated. Nov 19, 2009 at 18:43
  • This one was tricky for me the first time around too. Welcome to StackOverflow! Nov 19, 2009 at 20:00
  • 1
    Quite right! I've just been doing it (partly) based on your answer. Thanks a lot!
    – Toothbrush
    Feb 17, 2014 at 13:53
-1

I've never tried to run classic ASP in VS2008. But it is not a compiled language, and I don't think you can run a debugger on it. When I did ASP, I just did a bunch of Response.Write to debug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.