How to Run Classic ASP Securely on IIS Windows Hosting
In this article9 sections
Many business sites were built in Classic ASP, the server-side scripting language that Microsoft shipped with IIS for years. It is older than ASP.NET, and new projects use ASP.NET Core instead, but a large number of working sites still run on Classic ASP and need a host that keeps them running. If you have one, the question is how to keep it secure and fast without a rewrite. This guide shows how to confirm the site runs on Windows hosting, how to enable ASP and set its options in IIS, how to protect the site’s files and database, and how to plan the move to ASP.NET Core when the time comes.
Siteharbour’s Windows hosting runs IIS 10, which includes Classic ASP as an optional role service. The steps below work on that platform and any other IIS server.
Confirm the site needs Classic ASP
Classic ASP pages end in .asp, and they use <% ... %> blocks in VBScript or JScript. A site with .aspx pages is ASP.NET, which is a different technology and does not need this role service. Check the file extensions in the site folder before you change anything.
A simple test page confirms the server runs Classic ASP:
<%@ Language="VBScript" %>
<%
Response.Write "Classic ASP is running. Server time: " & Now()
%>
Expected: the text and the server time in the browser. If the page downloads as a file or shows its code, ASP is not enabled for the site, which Step 1 fixes.
Step 1: Enable ASP in IIS
In Server Manager, under the web server role, check that ASP is installed. On a hosted server, ask your host to add it if it is missing. Then open the site’s handler mappings in IIS Manager, and confirm that .asp is handled by the ASP handler. A site that was moved from another server often loses this mapping, which is why the page downloads instead of running.
Expected: the ASP role service is installed, and the .asp mapping points at the ASP handler. Load the test page again to confirm.
Step 2: Set the ASP options deliberately
Under the site’s ASP settings in IIS Manager, review the options that affect security:
- Enable Parent Paths should be False. When it is true, a path such as
../can reach folders above the site. - Error to browser should be False on a public site. Detailed errors reveal file paths and code.
- Script Error Message should be a plain message, not the internal detail.
- Session state should match what the site needs. Turn it off if the site does not use sessions.
Expected: the settings show the values above. A public site that shows a full error page to visitors is leaking information that an attacker can use.
Step 3: Protect the files and the database connection
Classic ASP pages often hold a database connection string directly in the code. Move it into a file that visitors cannot read, outside the web root, or into the server’s configuration. A connection string in a page that visitors can request is one of the most common causes of a data leak on older sites.
Check that the site folder does not allow directory browsing. In IIS Manager, open Directory Browsing for the site and set it to disabled. A folder listing shows every file the server can see, including backups and copies of old pages.
Step 4: Check the database access
A Classic ASP site usually connects to MS SQL Server or Microsoft Access. Give the site’s database user only the rights it needs, such as read and write on its own tables, and nothing on the server. The same principle applies to the database as to the application: the less access the connection has, the less damage a flaw does. The steps for a scoped database user in Plesk are in how to connect ASP.NET Core to MS SQL Server on Windows hosting, and they apply here too.
Keep the connection open for as short a time as possible, and close it at the end of each page. A page that leaves connections open exhausts the pool, and the site then slows down or fails under load.
Step 5: Back up the site and the database together
A Classic ASP site is only as safe as its backup. Back up the files and the database at the same time, so a restore brings back a matching pair. The steps in Plesk are in how to back up a Plesk website and restore it. Test the restore on a test domain once a quarter, because an old site is more likely to fail when it is restored after years of changes.
Step 6: Plan the move to ASP.NET Core
Classic ASP still runs on IIS, but Microsoft no longer adds features to it, and new development uses ASP.NET Core. A sensible plan moves one part of the site at a time: a new page or a new feature in ASP.NET Core, with the old pages still served by ASP. IIS can run both on the same site, which allows a gradual move without a big switch on one day. Keep a list of the pages that remain in Classic ASP, so the move has a clear finish.
Common mistakes
- Leaving detailed errors on. Visitors see file paths and code.
- Enabling parent paths. A crafted request can reach files outside the site.
- Storing the connection string in a public page. Anyone who requests the page can read it.
- Allowing directory browsing. The folder listing exposes backups and old files.
- Restoring the files without the database. The pair must match, or the pages fail.
Frequently asked questions
Is Classic ASP still safe to run?
It can be, with the settings in Step 2, a protected connection string, and a regular update of the server. Its age means it needs more care than newer code.
Why does my .asp page download instead of running?
The ASP role service is missing, or the .asp mapping is not set on the site. Step 1 covers both.
Can ASP and ASP.NET run on the same site?
Yes. Each file type is handled by its own mapping, so a site can serve both during a move.
How long will the move take?
It depends on the size of the site. Moving one section at a time keeps the risk low and lets the site stay live throughout.
A Classic ASP site can run securely on IIS if the ASP settings are tight, the connection string stays out of the public pages, directory browsing is off, and the files and database are backed up together. Plan the move to ASP.NET Core one section at a time, with a list of the pages that remain. For the hosting choice behind the site, read Windows hosting or Linux hosting: which to choose.