Hellworld.asp

Page source

<HTML> <HEAD> <TITLE>Hello World with date and time of birth</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <h2>Hello World!</h2> I was born at 5:56:56 AM on 8/26/2005 </BODY> </HTML>

Script listing

<HTML> <HEAD> <TITLE>Hello World with date and time of birth</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> <% response.write ("<h2>Hello World!</h2> I was born at " & time() & " on " & date()) %> </BODY> </HTML>

Explanation

When a Web browser requests an HTML page, the server returns the page to the browser. With an ASP page, it treats everything between <% and %> as part of a program to be executed by an interpreter running on the server.

Material to be returned to the browser is included in the response object. Anything outside the <% ... %> is added to the response object. The program executing between the <% ... %> generates output using the write method of the response object.

Our first example, Helloworld.asp, is a standard HTML page with one line of code inserted in the middle. As you see, that line of code writes a string of HTML with the current time and date to the response object. That line will be between the <body> and </body> tags.

In this example, the program is written in VB Script, a variant of VB.NET, but any language for which there is an IIS-compatible interpreter can be used.


Disclaimer: The views and opinions expressed on unofficial pages of California State University, Dominguez Hills faculty, staff or students are strictly those of the page authors. The content of these pages has not been reviewed or approved by California State University, Dominguez Hills.