Active Server Pages

Most people begin making web pages by creating static HTML.  This is the most logical way to start, but if you want your site to be dynamic in some way, Active Server Pages is probably the easiest way to accomplish this.  ASP is really a container for a scripting language. Microsoft created ASP, and made it versatile enough to handle multiple languages including VBScript and JavaScript among others.

ASP scripts are plain ASCII files, so you don't have to have a special program to write ASP.  Unlike HTML, you can't just place an ASP file on your server and have it work.  In order to handle ASP files, your server must have the proper programs and file associations setup. Otherwise, your server will not handle the files as scripts or HTML. Making sure the server is configured to run ASP is something that your server administrator will have to do. The Homepages server at UF is already setup to handle ASP scripts.

Once your server is running the software required to handle ASP, you can change the file extension on any HTML file to ASP, and the server will handle the file properly.

DEFAULT.HTM  ---change-extension--->  DEFAULT.ASP

Renaming a file like this doesn't automatically put scripting information into the file. Renaming the file tells the server that the file "may" contain scripting information. ASP uses a server-side scripting process. This means that the server looks at all the HTML code before sending it to your browser. If there is scripting information, the server processes it, and sends the result to your browser. It is important to understand that your browser will only see the results of the script, not the script. The script is only seen by the server.

The server understands that ASP files are HTML with special information inserted.  In addition to standard HTML codes inside greater than/less than signs, ASP uses the percent sign inside the greater than/less than signs like this

<%scripting information%>

If there are percent signs in the HTML code, the server processes the scripting information between those percent signs, and sends the result to the browser. If there are no <% %> codes in the ASP file, it is treated just like a normal HTML file.

When there are <% %> codes, the scripting instructions are executed, and the resulting information is placed into the HTML file that your browser views.  For instance, if this line of code were in an ASP file

<%= time %>

The result would be the current time, and written back into the HTML as

12:29:26 PM

Click here to see this one-line script on a page.

The Time

The code for the above "time" script page looks like this.

<p> When you clicked the link, the time was <% =time %>. </p>
<p>View the source of this page. Do you see anything that shows how the correct time was placed on this page?<br>
Click the Refresh button in your browser to see the time updated. </p>

From your browser, view the source of the page. Only the results of the scripting are seen, not the script itself.  So unlike HTML, you can't look at the source code of a page to see how the webmaster did something.

Using ASP scripts, you can request information from a browser, give information to a browser, connect to databases on your server, send email, determine things about the user connecting to your site (like version of browser and IP number), and many other things.

Some Simple Scripts

Home - What Is ASP - Simple Scripts - Using Forms - Form Elements - Form Processing - Session Variables - IF THEN ELSE