Debugging classical ASP pages in 2.0

I guest everyone knows how to debug asp.net applications. You either a) run the web project directly or b) attach to asp.net worker process (aspnet_wp.exe) and run your web page from browser. But do you know that even classical asp pages can be debugged in Visual Studio IDE?. Here is how you do it.

You need to attach to dllhost.exe that is associated with asp runtime.

1. Choose Debug->Attach to process
2. You will find more than one dllhost.exe running on your machine, so you need to select the correct one. Locate the one whose type is something like "Script, x86" and the user name is the same as that configured on your IIS (something like IWAM.....). To know the user goto IIS->Default Website->Directory Security-->Anonymous User.
3. In the "Attach to" option select "Scripts" (by default it would be managed code)
4. Click on attach button.
5. Add a break point in asp code and run the page in the browser.

Thats it, it should be working. If it doesn't work, feel free to mail me.

No comments: