Search Tools Links Login

Intro to ASP syntax


Attention ASP newbies! Looking to create your first ASP page? Check out this tutorial!

Original Author: Brad Hess from http://www.4aspdev.com

Code

Let’s code our first ASP page. To do this write out
the following code in your choice of development environment.







<HTML>

?á?á?á <
BODY>

?á?á?á?á?á?á?á <
B>Welcome
to my webpage hosted on PWS!B>

?á?á?á?á?á?á?á <BR>The
time is now: <%=Response.Write(TIME())%>


?á?á?á?á?á?á?á <
BR>

?á?á?á?á BODY
>

HTML>

Save the file in the c:Inetpubwwwroot directory on
your machine and name it default.asp. Try accessing your website by opening a
browser and typing http://127.0.0.1/default.asp or http://yourmachinename/default.asp.
127.0.0.1 is what is called the loopback address and is the TCPIP address that
points at your machine. The text: Welcome to my webpage hosted on PWS! should
now show up. On the line under you should read "The time is now:"
followed by the current time.
Like
this
only without the Back link. If the time is
showing up correctly you have a working ASP server running on your PC!. If the
time does not show up correctly then something is wrong with the installation of
personal web server


Now that we have an ASP page. Lets look at what is
really happening when the page is requested. The code is as follows







<HTML>

?á?á?á <
BODY>

?á?á?á?á?á?á?á <
B>Welcome
to my webpage hosted on PWS!B>

?á?á?á?á?á?á?á <BR>The
time is now: <%=Response.Write(TIME())%>


?á?á?á?á?á?á?á <
BR>

?á?á?á?á BODY
>

HTML>

The code color syntax is the same as you will see in
Interdev and Frontpage.?á Most of the code in this page is plain HTML,
however the inside?á <%
and %> is ASP code.?á The <%
and %>?á seperates the
HTML code from ASP code.?á The server recognizes the <%
and %> and processes anything
contained inside.?á Response.Write calls the Response Object that is part of
the ASP object model. The write part of response.write calls the write method of
that object. I will expand upon this more in the future. TIME()
is recognized by the script engine as a function that retrieves the current
time.

You just created your first dynamic website every time
it is requested it will be updated with the current time on the server. While
this is not really helpful it works well as an example.

See my next tutorial on the ASP object model to get a
better idea of what all ASP supports.


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 104 times

Categories

ASP/ HTML

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.