An ASP script is
very much like an HTML file.It includes HTML tags , text , and server side scripts
, and can also include client side script .The first difference is that
an ASP script must have an .asp extension. ASP is usually written using
Visual Basic, Scripting Edition (VBScript) or JScript. I use VBScript.
In order to run
an ASP script you should do the following things:
1)First
of all, you will need a server to run your ASP scripts. If you are running
Windows 98, the Personal Web Server is included on the CD. If you are running
Windows 95 or NT 4, download NT Option Pack 4, which is free to download
and use.
2)Once its
downloaded install it following the directions provided by the install
routine .
3)Enable
Web services by PressingStart button.
4)Name the
server. By default server will take the name of your computer.The name will
appear on the publishing panel of the Personal web Maneger.If the machine has
not been named , then the will adopt the name localhost.
5)Open up
a text editor – Notepad or any other plain text editor will do. We’ll
start out with a very simple script… a take-off on the old “Hello World”
script.
There are two ways
to identify server-side script within the HTML code.
the RUNAT=SERVER attribute in the <SCRIPT> tag.
… %> sever script delimiters.
We’ll begin by
writing a bit of standard html. This sets up the html page that the script will
write to. Then, we’ll put in a bit of vbscript, which is enclosed by <% and
%>, to write to the page and generate today’s date. We’ll then end the script
with standard HTML.
<html>
<head>
<title>First ASP script</title>
</head>
<body>
<%
Response.Write “Hello, ASP World!”
%>
</body>
</html>
6)Save this
ASP scripts as hello.asp to a directory within your wwwroot. The standard
path for NT Option Pack is c:\inetpub\wwwroot and for Win98 PWS (and older win95
versions of PWS if I recall correctly) its c:\webshare\wwwroot. You must also
properly configure the directory in which you save your ASP scripts. The directory
must allow scripts access, and generally its a good idea to turn off read access
in that directory for security reasons. I’m going to create a new directory
and put all examples in that directory.To create a new directory do the following
steps.
explorer and create a new directory named AspEg under c:\inetpub\wwwroot
and click on Advanced icon.
the directory <Home>
Add.. button , and click on Browse.. Button and select the directory
c:\inetpub\wwwroot\AspEg.
add some alias also.
and Scripts checkboxes , and leave Execute checkbox empty.
7) Run your
favorite browser, and point it to http://localhost/AspEg/hello.asp