Debugging classic ASP web application with Visual Studio 2005

Finally, I got it; after a long and tiring evening of hit and trial I was able to hit a breakpoint in my asp page :)

So you might think how come I suddenly moved from asp.net and Reporting services to classic asp, a long story in short is that right now I am assigned a task to migrate our company's timesheet application from classic asp to asp.net. This is the first time I am working on asp application and in first look application looked like it's from some other world, but somehow I was able to get it working in VS 2005.

Now came the real twist, I was able to access the users page of timesheet but not the admin, every time I tried running any admin page I was redirected to client page. As an asp.net developer for the last 3 years I was so used to debug my application using VS debugger that I just added a breakpoint in application and hit F5(hoping that I will be able to step through the code); but what's this, breakpoints were never hit, no symbols were loaded :(

image

So as you can imagine I just did some hit and trial without any luck. After searching for a while I landed to a few useful links -

http://www.devx.com/tips/Tip/18204

http://msdn.microsoft.com/en-us/library/aa291223(VS.71).aspx

But even after following all these steps nothing happened. Finally I bumped (lucky me) into this thread

Visual Studio 2005 debugging not working for ASP pages

and as author said...VOILA it worked, breakpoint was hit, thank god.

So I just thought to note down steps I followed and what worked.

 1. Enable ASP server-side script debugging in website's configuration properties -

image

 2. Run the application (F5) and then attach to the Dllhost.exe process -

a. Go to Debug->Attach to process menu in VS.

b. Check "Show processes from all users" check box.

c. Select dllhost.exe (Script code, T-SQL code) and click attach.

image

That's it, breakpoints will get hit and you can debug your application.

But still there are some things which are not required but worth mentioning -

 1. Almost in all related articles it was mentioned that you need to enable asp debugging in your asp projects configuration properties, but in my scenario I had added my application as local IIS website and its properties didn't had any such option. Even, It's not required to enable native code Debugger.

image

 2. Its mentioned that you need to add your user account or IWAN_MACHINENAME account to your systems "Debugger Users" group, but I tried it without that and debugging worked perfectly.

image

I guess it was a good start to my new project, learned quite a few new/good things.

22 Comments

  • Fantastic work man. Working superb.

  • If you use IIS 7 you should attach to w3wp process instead dllhost.

  • Great Joshi very useful

  • good stuff mayne, this took me a month to figure out on my own...wish i would have bumped into your post sooner. 4get response.write and response.end!! =(

  • This is great stuff. well done mate. Working in classisc asp is very depressing. I also need to migrate an old legacy web application into ASP.NET and step through the old legacy code.

    Omar

  • Thanks everyone

    @Samir - Thanks for the information, I am sure it will be helpful to many
    @Omar - Yes its really tough to work in Classis ASP specially after working with asp.net; but one positive is that working in ASP helps you understand the real power of asp.net and appreciate it.

  • Thanks, quick, practical, and very useful!!

  • This blog is very useful. My problem was resolved..thanks a lot
    cheers

  • Hi,
    DLLHOST is not listed in the "Attach to process" window. Do you know how to find it.

  • Thanks, that was a lifesaver! It did not work straight away for me though, but after reading the comment above about IIS7, I tried connecting to the w3wp process instead of dllhost, and hit success (note that I have no idea how to verify the version of IIS I'm running, but who cares, it works :-)).

  • What if the Classic ASP calls a VB DLL ??

  • I had to give the IWAN_MACHINENAME permission on the local directory where the website was stored as this was outside the inetpub/wwwroot folder structure. Then worked perfectly.

  • I hope it isn't too late to ask a question on this two year old page, but here goes:

    How do you make your loosely coupled .asp and .inc pages come through as a project or solution? This wonderful tutorial starts out with that part already in place, apparently.

    My eMail address is: PaulGScannell@verizon.net

    Thanks,
    Paul

  • I follow all the step mention above.I m using IIS7 so i attach process to w3wp process instead dllhost.But i can't put the break point in my code.So can anybody tell me what is wrong.

    Thanks
    Sab

  • How to do the same in VS 2008 SP1 ? plz tell it is urgent.

  • Thanks! I was trying it for so long

  • Thanks dude..It is really helpful. I was looking for this from long time :)
    Thanks again

  • Make sure you tick the "Show processes from all users" checkbox at the bottom-left of the "Attach to process" dialog as shown in the picture in step 2 above!

    The DLLHOST process is usually be run by the asp application user (the one with your machine name and "IWAM" in it...) I think it depends on the way your asp app authenticates, but if you don't see DLLHOST in the list this is probably the case.

  • This article is very helpful. Great work. Thanks.

  • Necesito ayuda.
    tenia una aplicacion hecho en asp.net y mi maquina estaba con sistema operatiov WINDOWS XP, pero ahora me instalaron windows 7 y no me funciona al dar f5 no se me ejecata...............

  • Thanks.. this was very helpfull for me.. great!!

  • @Angelo - Thanks Angelo, this looks really useful; but unfortunately it's not free.

Comments have been disabled for this content.