Just in Chronicles

Life as a Voyage

Posts Tagged ‘Classic ASP

Setting Up Classic ASP Websites on IIS 7.5 with Visual Studio 2010

with 12 comments

There are still many websites built and maintained with classic ASP because of many reasons. This post will cover two topics – how to setup classic ASP websites on IIS 7.5 and how to manage codes using Visual Studio 2010.

Conditions:

  • OS: Windows 7 Professional SP1
  • Web Server: IIS 7.5
  • IDE: Visual Studio 2010 Professional SP1

I haven’t tested it any other than above. So, if you have a little bit different environment from mine, please bear in mind.

How to Setup Classic ASP Websites on IIS 7.5

Firstly, your IIS must turn on ASP features. Go to Control Panel > Programs and Features > Turn Windows features on or off. Then, tick the checkbox next to ASP and click OK.

 01.Turn.On.ASP.Features.On.IIS

Now, your IIS is able to run ASP websites. The next step is that your IIS needs a new Application Pool for the ASP websites. Go to Control Panel > Administration Tools and open Internet Information Services (IIS) Manager. Then create a new Application Pool.

02.Set.Up.Application.Pool-1

03.Set.Up.Application.Pool-2

Make sure that an administrator account as a Custom account for the Application Pool Identity must be selected. From the diagram above, Administrator is selected.

Once the new Application Pool is added, a new website using this Application Pool needs to be created to host classic ASP pages.

 04.Set.Up.Website-1

A new website for classic ASP is now created. It’s time for the website to recognise ASP script. Go to the website you’ve just created and find ASP item under the IIS section. Click it and set the below four to “TRUE“.

 05.Set.Up.Website-2

Once you finish the steps above, your classic ASP website should be up and running. This IIS setting also helps your Visual Studio 2010 debug the web page script.

Now, it’s time for Visual Studio 2010 to setup to manage the classic ASP codes.

How to Manage Classic ASP Codes Using Visual Studio 2010

In order for your VS 2010 to manage the classic ASP codes, three things must be done before starting to code.

First of all, register .asp file extension to your VS 2010.

 06.Set.Up.Visual.Studio-1

This enables you to see syntax highlighting and code intellisence feature. Now, open the website by clicking File > Open Web Site…. Make sure that it’s “File System“, not anything else.

07.Open.Website-1

08.Open.Website-2

Depending on your preference, create a new solution and add a new website project under the solution. By doing so, the website will be more manageable.

Now, it’s time to create a web page. Create a new item and select an HTML Page. As a default, the filename will be HTMLPage.htm. Rename it to default.asp.

 09.Create.Page-1

10.Create.Page-2

A new default.asp page is created. Type some classic ASP code into the page.

 11.Create.Page-3

As we have already setup the syntax highlighting and code intellisense feature, in order to enjoy them, put the code <%@ Language="VBScript" %> at the first line and you will see the result like above.

Open your web browser and open the page you just created.

12.Create.Page-4

Please note that you can see the break point at the left next to the line number. That means we can also debug the classic ASP codes. As usual, in order to utilise the debug functions, you have to run VS 2010 as an administrator privilege. Before starting to debug, the website property must be configured.

 13.Debug.Page-1

As VS built-in web server doesn’t support classic ASP, we have to use our local IIS for debug. So, setup the property like above. And use “Attach to Process” from the Debug menu. Once you run the “Attach to Process” command, you’ll get the screen like below. Find w3wp.exe bound by the account that we setup on IIS previously (that is Administrator here in this post).

 14.Debug.Page-2

Now, try to run the website again and you’ll get the break point highlighted.

 15.Debug.Page-3

So far, we have setup and reviewed how to set up classic ASP website to run on IIS 7.5 and code it on VS 2010. By default, classic ASP is not chosen by IIS and VS 2010. So, some configuration change must be performed in order for that.

Try it and enjoy your ASP coding.

Advertisements

Written by Justin Yoo

12/12/2012 at 15:48