Note: This is a reference page with static code examples. Classic ASP requires Windows Server with IIS (Internet Information Services) to run, which is not available on this Linux/Apache server.
Overview
Released: 1996 by Microsoft
File Extension: .asp
Server Required: Windows Server with IIS
Default Language: VBScript (JScript also supported)
Classic ASP was Microsoft's answer to PHP and other server-side scripting technologies. It allowed developers to embed VBScript or JScript code directly in HTML pages, which IIS would process before sending to the client.
Classic ASP was widely used in enterprise environments during the late 1990s and early 2000s, but has been superseded by ASP.NET. However, many legacy applications still run on Classic ASP.
Hello World
The <% %> delimiters contain server-side code, similar to PHP's <?php ?>.
<%@ Language="VBScript" %>
<!DOCTYPE html>
<html>
<head>
<title>Hello, ASP!</title>
</head>
<body>
<h1>Hello, ASP!</h1>
<p>This page was generated with Classic ASP</p>
<p>Current time: <%= Now() %></p>
<p>Your IP: <%= Request.ServerVariables("REMOTE_ADDR") %></p>
</body>
</html>
Environment Variables
Classic ASP accesses server variables through the Request.ServerVariables collection:
<%
Dim key
For Each key In Request.ServerVariables
Response.Write("<b>" & key & ":</b> ")
Response.Write(Request.ServerVariables(key) & "<br>")
Next
%>
Form Handling (GET)
Query string parameters are accessed via Request.QueryString:
<%
Dim name, email
name = Request.QueryString("name")
email = Request.QueryString("email")
If name <> "" Then
Response.Write("Hello, " & Server.HTMLEncode(name))
End If
%>
Form Handling (POST)
POST data is accessed via Request.Form:
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
Dim username
username = Request.Form("username")
Response.Write("Posted username: " & Server.HTMLEncode(username))
End If
%>
Sessions
Classic ASP has built-in session support:
<%
Session("username") = Request.Form("username")
Dim savedName
savedName = Session("username")
Session.Abandon
%>
Legacy Technology: Classic ASP is considered legacy. Microsoft recommends ASP.NET for new development. However, understanding Classic ASP is valuable for maintaining older systems.
← Back to Home