Chapter 27: ASP Classic
ASP Classic (also called Classic ASP or just ASP), the very first Microsoft technology for building dynamic websites on the server side.
This is not the same as ASP.NET, Razor, Web Pages, MVC, or anything modern we have been discussing before. Classic ASP is a completely different animal — much older, much simpler, and still running on a surprising number of legacy corporate systems in 2026.
Think of it as the “grandfather” of server-side web programming in the Microsoft world.
I will explain it like your favorite old-school computer teacher who actually programmed in it back in 2000 — slowly, with real examples, warts and all.
1. What does “ASP” stand for and when was it born?
ASP = Active Server Pages
First public release: December 1996 (IIS 3.0) Really became popular: 1998–2002 (IIS 4.0 + 5.0 era)
It was Microsoft’s answer to:
- CGI (very slow)
- Perl / early PHP scripts
- ColdFusion
- Java Servlets / JSP
Goal: allow ordinary web developers to make pages that change content dynamically (read database, show different content per user, process forms, etc.) without compiling huge applications.
2. Core Facts About Classic ASP (Write these down)
| Fact | Details |
|---|---|
| File extension | .asp |
| Primary language | VBScript (default) — sometimes JScript (Microsoft’s JavaScript) |
| Runs on | IIS (Microsoft Internet Information Services) on Windows only |
| Execution model | Interpreted (not compiled) — every request parses & executes the file |
| Mixing code & HTML | <% … %> code blocks + <%= expression %> for output |
| State management | Session, Application, Cookies, QueryString, Form |
| Database access | ADO (ActiveX Data Objects) — mostly classic ADODB.Recordset |
| Current status (2026) | Officially dead — no new features since ~2002, security support ended years ago |
| Still used? | Yes — thousands of internal business systems, old government sites, legacy e-commerce |
3. Classic “Hello World” in Classic ASP
Create file: hello.asp
|
0 1 2 3 4 5 6 |
<%@ Language=VBScript %> <% Option Explicit %> <!DOCTYPE html> <html> <head> <title>My First Classic ASP Page</title> </head> <body> <h1>Hello from Classic ASP!</h1> <% ' This is a VBScript comment Dim name name = "Webliance from Hyderabad" Response.Write "<p>Welcome, " & Server.HTMLEncode(name) & "!</p>" %> <p>Current server time is: <%= Now() %></p> </body> </html> |
Important lines explained:
- <%@ Language=VBScript %> — tells IIS to use VBScript (default anyway)
- <% Option Explicit %> — highly recommended — forces you to declare all variables with Dim
- <% … %> — code block — pure VBScript
- <%= expression %> — shortcut for Response.Write expression
- Response.Write — sends text to the browser
- Server.HTMLEncode — prevents XSS by escaping < > & etc.
- Now() — VB function for current date/time
4. Classic ASP Form Example – Name Greeting + Length
welcome.asp
|
0 1 2 3 4 5 6 |
<%@ Language=VBScript %> <% Option Explicit %> <!DOCTYPE html> <html> <body> <h2>Tell me your name</h2> <form method="post" action="welcome.asp"> Name: <input type="text" name="username"> <input type="submit" value="Say Hello"> </form> <% If Request.Form("username") <> "" Then Dim user user = Trim(Request.Form("username")) Response.Write "<h3>Hello, " & Server.HTMLEncode(user) & "!</h3>" Response.Write "<p>Your name has " & Len(user) & " characters.</p>" End If %> </body> </html> |
Key classic-ASP patterns here:
- Same page handles both display and processing (action=”welcome.asp”)
- Request.Form(“fieldname”) — reads posted data
- If … Then … End If — VBScript conditional
- Trim() — removes spaces
- Len() — string length
- Server.HTMLEncode() — security (very important — many old sites got hacked because they forgot it)
5. Classic ASP Database Example (ADO – very typical 2000–2005 code)
|
0 1 2 3 4 5 6 |
<% Dim conn, rs, sql Set conn = Server.CreateObject("ADODB.Connection") conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("database.mdb") sql = "SELECT ProductName, UnitPrice FROM Products ORDER BY ProductName" Set rs = conn.Execute(sql) If Not rs.EOF Then Response.Write "<table border='1'>" Response.Write "<tr><th>Product</th><th>Price</th></tr>" Do While Not rs.EOF Response.Write "<tr>" Response.Write "<td>" & Server.HTMLEncode(rs("ProductName")) & "</td>" Response.Write "<td>" & FormatCurrency(rs("UnitPrice")) & "</td>" Response.Write "</tr>" rs.MoveNext Loop Response.Write "</table>" Else Response.Write "<p>No products found.</p>" End If rs.Close conn.Close Set rs = Nothing Set conn = Nothing %> |
→ This style was everywhere 1998–2008 — ADODB, Recordset, .MoveNext(), manual HTML building.
6. Summary Table – Classic ASP vs Modern Razor / ASP.NET Core
| Feature | Classic ASP (1996–2002) | ASP.NET Razor (2010+) & Core |
|---|---|---|
| File extension | .asp | .cshtml / .vbhtml |
| Language | VBScript (or JScript) | C# or VB.NET (full languages) |
| Code delimiters | <% … %> and <%= … %> | @ and @{ … } |
| Compilation | Interpreted every request | Compiled (much faster) |
| Database access | ADODB (Recordset, .Open, .MoveNext) | Entity Framework / Dapper / ADO.NET |
| Security defaults | Very weak (XSS, SQL injection common) | Built-in encoding, parameterised queries |
| Modern status (2026) | Legacy – no updates, insecure | Current & actively developed |
| Learning curve (today) | Easy to read old code, hard to secure | Steeper but future-proof |
7. Final Teacher Words
Classic ASP was revolutionary in 1998–2002:
- Allowed normal people to make dynamic websites
- Powered millions of small business sites, intranets, early e-commerce
- Very easy to learn (VBScript is simple)
- Ran on cheap Windows hosting
But in 2026:
- No longer safe — no security patches
- No longer fast — interpreted, no modern caching
- No longer supported — Microsoft ended support years ago
- Still alive in many banks, governments, old factories — maintained out of fear of migration cost
So when someone says “ASP” today, they usually mean Classic ASP — not ASP.NET.
If you ever see .asp files with <% … %> and Response.Write — that’s Classic ASP.
Questions?
- Want to see a full login system in Classic ASP (very typical 2000s code)?
- Or compare Classic ASP vs PHP from the same era?
- Or explain why companies still run it in 2026 (and the risks)?
- Or jump back to Razor / modern .NET?
Tell me — I’m here! 🚀🇮🇳 Happy learning from Hyderabad! 😊
