Jump to content

Active Server Pages/Your first page

From Wikibooks, open books for an open world
Previous: Differences between ASP 3.0 and ASP.NET Index Next: Basic ASP Syntax

Objectives

[edit | edit source]
  • Embed ASP scripting code into a web page.
  • Upload your ASP page to a server.
  • Test your page by viewing it in a web browser.

Content

[edit | edit source]

ASP is delimited with "<%" and "%>"
within these delimiters is your custom code that is executed in the server.

Here is a small fragment of an ASP code (it outputs "My First ASP" on your browser):

<%
Response.Write "My First ASP"
%>

Or you could put the text into a pre-defined variable:

<%
Dim MyText

MyText = "My First ASP Page"
Response.Write MyText
%>

Here is a way to separate your code from your page layout.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%

Dim MyText

MyText = "My First ASP"

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>My First ASP</title>
</head>

<body>
<%=(MyText)%>
</body>
</html>

Summary

[edit | edit source]

Review Questions

[edit | edit source]

Exercises

[edit | edit source]
Previous: Differences between ASP 3.0 and ASP.NET Index Next: Basic ASP Syntax