hitmill.com logo



ASP Server-Side Basics

for Active Server Pages

Definition and Opening ASP Code
An Active Server Page is a Web page that has server-side scripting which is interpreted on the server by the ASP engine. This ASP engine is actually a dynamic-link library called asp.dll, which is installed on the Web server. The ASP page may also contain HTML and client-side scripts, but only the actual ASP code is interpreted on the server, with the output of the ASP and the remaining HTML and client-side script being sent back to the browser. The end-user never sees the actual ASP code, but only the output of the ASP, or the results of it. Often, ASP code uses the <% and %> delimiters to set it off from the other HTML and client-side code.
<% @language = "vbscript" %>

This is the code used to tell the asp engine that there is ASP on the page. <% @language="vbscript" %> specifies which scripting language is being used, and this line of code needs to be on the first line of a Web document, and above the <HTML> tag. This document will now require the .asp extension. If there is even one line of server-side code, the page will need to have the .asp extension. Pages with the .asp extension are automatically sent to the ASP interpreter (ASP engine) by the Web server where the ASP code is interpreted, executed.
The Global.asa File
A Web application is a group of ASP pages within the same parent folder, which may have one or more subfolders. Each Web application may have only one global.asa file, also known as the global application file. This text file on the main root of the Web application allows a programmer to associate pages within the application so that information can be shared across the pages. The global.asa file may contain variables, functions, and sub procedures. The four main subs of the global.asa file are named: Sub Application_OnStart and Sub Application_OnEnd as well as the pair of Session sub-procedures named Sub Session_OnStart and Sub Session_On End.
There is to be no HTML nor client-side script in the global.asa file. This text file is only for the purpose of server-side script, variables, functions, which are executed when a Web application starts or stops, or a browser session starts or stops. Variables defined within the global.asa file are global, available to all of the pages within the Web Application. Since only one global.asa file is allowed per Web application, multiple Web applications cannot be nested. (Only one global.asa file would be read, resulting in errors from the other global.asa file.) If the application variables are stored in the Application_OnStart sub, then they are not lost from the memory if the server is stopped, but rather, can be reassigned when the server resumes activity.

Something is going on...
Server side and client side ASP coding examples coming soon.


Contact Webmaster
Updated 29 Aug 2008
© hitmill.com
All Rights Reserved