My Account Subscribe Help About
Sign In | Register FREE
Friday, April 10, 2026
Ceasefire or no ceasefire, the Middle East's reshuffling is not yet doneMan arrested after baby girl dies from dog biteMan jailed for killing abused wife who jumped from bridgeMelania Trump denies ties to Jeffrey Epstein and urges hearing for survivorsSimple guide: How the Iran war is affecting the cost of holidays, food and clothesMen behind 'Tripadvisor for people smugglers' jailed for 19 yearsIreland protesters willing to 'close the country' over fuel costsEU fingerprint and photo travel rules come into forceIran conflict will define us for a generation, says PMBafta fell short in duty of care when racial slur was shouted, review findsExtra £5m pledged for patrolling places of worship in London and ManchesterLebanon says ceasefire must be in place before Israel talks'Endless fears': Even if fighting stops, the damage to Iran's children will endureHow many ships are crossing the Strait of Hormuz?Want to help garden birds? Don't feed them in warmer months, says RSPBCan stats help you find the Grand National winner?Ten cases a day - 'blitz courts' could tackle the Crown Court backlogThis coat cost $248 in illegal tariffs. Will he ever get the money back?From a smuggled harmonica to Artemis' playlist - the history of music in spaceLava soars into air as Hawaii's Kilauea volcano erupts againWeekly quiz: What might have made Paddington panic about his marmalade?LeBron and Bronny James record first son-to-father assist in NBA history'I was in a slump - now my art is in Billie Eilish's house'Labrinth not involved in Euphoria's third seasonWhite House staff told not to place bets on prediction marketsRussia and Ukraine agree to Orthodox Easter truceBBC News appIs Defence Secretary Pete Hegseth waging a holy war against Iran?Defence secretary interview on Russian submarine operationWhat version of Tyson Fury will turn up this weekend?
FDN » ASP & VBScript » ASP Fundamentals

ASP Fundamentals

ASP Fundamentals

Active Server Pages (ASP) is Microsoft's server-side scripting technology for building dynamic web pages. ASP code runs on the web server (IIS) and generates HTML sent to the browser.

ASP File Structure

ASP files use the .asp extension. Server-side code is enclosed in <% %> delimiters:

<%@ Language="VBScript" %>
<!DOCTYPE html>
<html>
<head><title>My First ASP Page</title></head>
<body>
  <h1>Hello, World!</h1>
  <p>The current date and time is: <%= Now() %></p>
  <p>Your IP address is: <%= Request.ServerVariables("REMOTE_ADDR") %></p>
</body>
</html>

Built-in Objects

ObjectPurposeExample
RequestRead data from the client (form data, query strings, cookies, headers)Request.Form("username")
ResponseSend data to the client (HTML, cookies, redirects)Response.Write "Hello"
ServerServer utility methods (path mapping, COM object creation, encoding)Server.CreateObject("ADODB.Connection")
SessionPer-user state that persists across requests (20 min default timeout)Session("UserID") = 42
ApplicationApplication-wide state shared by all usersApplication("VisitCount")

Request Object Examples

<%
' Query string: page.asp?id=5&name=John
Dim strID, strName
strID   = Request.QueryString("id")
strName = Request.QueryString("name")

' Form data (POST)
Dim strUsername, strPassword
strUsername = Request.Form("username")
strPassword = Request.Form("password")

' Cookies
Dim strTheme
strTheme = Request.Cookies("theme")

' Server variables
Dim strMethod, strUserAgent
strMethod    = Request.ServerVariables("REQUEST_METHOD")
strUserAgent = Request.ServerVariables("HTTP_USER_AGENT")
%>

Response Object Examples

<%
' Write output
Response.Write "<p>Welcome, " & Server.HTMLEncode(strName) & "</p>"

' Set a cookie
Response.Cookies("theme") = "classic"
Response.Cookies("theme").Expires = DateAdd("d", 30, Now())

' Redirect
Response.Redirect "login.asp"

' Set content type
Response.ContentType = "application/json"
%>
« Back to ASP & VBScript « Back to FDN