views:

1277

answers:

4

Whenever I try to open a classic asp page while running the site in VS2008 I get the error: "This type of page is not served".

How do you Debug/Run classic asp pages in Visual Studio 2008?

AnthonyWJones has the correct answer but it is not letting me select an answer for some reason.
Here is a tutorial I found that goes into more details how to set up VS2008 and XP to debug classic asp

+3  A: 

Use IIS for the server and Response.Write for the debugging. The way we did it "back in the day" ;)

John Sheehan
Umm... yikes, I never did that way, even "back in the day" and I go way back.
AnthonyWJones
+12  A: 

The Developer Web Server (Cassini) only supports ASP.NET and static content.

You need an instance of IIS running on your dev machine.

Windows XP

On XP you need to modify the Default Web site so that either its home directory is pointing at your sites root folder or create a new virtual directory and configure it as an application. In either case you would want to set the application isolation to "High"

Hit your web site directly with a browser, then in VS 2008 use Debug->Attach to Process. You need to attach to a process with the name "DLLHOST.EXE". There will be more than one but most likely only one of them will contain the word "Script" in the Type column and thats the one you want. Make sure the "Attach to" box above the list of processes contains "Script".

Vista/Windows 7

Vista and Windows 7 will use IIS7 and that will allow you to create a new site if thats your preference. Make sure that the application has its own App Pool.

The procedure then is much the same except you are looking for W3WP.exe processes instead. If there are more than one that show "Script" in the type you can just attach to all of them.


With this in place you can set breakpoints, examine exceptions, and do all the normal stuff you could do with script debugging.

AnthonyWJones
Could you flesh out this answer more. There's some throw-away lines, "your sites root folder" My site's root folder? Or my sites root folder? What is my "sites" root folder, or what is "my site's" root folder? How can you debug stuff that happens before a browser hit?
Ian Boyd
@Ian: The root folder in this context is the folder that appears as the "project name" under the solution node in the VS solution explorer for a Web Site project. Its the this folder that you would set in IIS as being the home directory for the application to be debugged.
AnthonyWJones
@Ian: What kind of stuff happens before a browser hit? Are you talking about application/session start which happens on the first hit? Use the VBScript `stop` keyword to kick off to a debugger then choose the VS instance that has the Web site "project" loaded from the provided list.
AnthonyWJones
That works! So awesome.
Kenneth J
A: 

Like AnthonyWJones said, you cannot debug non-ASP.Net code in Visual Studio development server.

However, if you have IIS 6.0 installed in your machine, you can use the Microsoft Script Debugger, which possibily will already be installed in your machine (mine has).

Here you can learn how to enable the IIS 6.0 to be debugged: http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/3c7830b4-df5c-41a2-9890-c201eb774c89.mspx?mfr=true

kurast
Ramesh Vel
+1, since you are right, "you cannot debug non-asp.net code in Visual Studeio development server". Although, i believe you can debug non-asp.net code in visual studio. i'll leave it to @Ramesh Vel to post steps to backup his claim.
Ian Boyd
you should not put apostrophes where you created the text @Ravesh Vel. I have not said that in my text. i only said that you cannot host no asp .net code in the DEVELOPMENT SERVER, not in the VS as a whole
kurast
+1  A: 
Assuming you are running Windows XP with IIS installed and VS 2008 with the
default settings pref "General Developer Settings" you need to enable ASP
debugging in IIS:

Open Internet Information Server management console
Right click the "Default Web Site"
Left click "Properties"
Select the "Home Directory" tab
Left Click the "Configuration" button
Select the "Debugging" tab
Check both fags in the Debugging Flags section
Click Ok on all the dialogs until you are back to the management console
Close the management console

You now need to set permissions, you need to ensure that the IWAM user and the
IIS authenticated user have read access to the ASP file you want to debug.  I
find working as an administrator helps with permissions.  Note permissions will
probably be your biggest hurdle.

Now you need to edit your ASP page and place the word "Stop" in the code just
before where you want to debug, Note: you require to be logged into the Console
session in windows if you are using Remote Desktop.

Browse to the page in question and you shout be prompted to debug, you will then
choose what debugger you want to use, select VS2008, now you are debugging
Classic ASP.

Note:
This is from memory so if you have any trouble let me know, also VS2005 is
better for debugging Classic ASP.

I don't know if the Express editions will work with those instructions.

All asp pages have to be hosted in IIS.

Robert