Active Server Pages

Active Server Pages (ASP) is a standard developed by Microsoft to serve web pages with dynamic content. An ASP document has an ".asp" extension and uses embedded scripting to insert dynamic data into the page before it is sent to the user's browser. The GoAhead WebServer supports an open scripting architecture where scripting engines can be selected at run-time. Individual pages can use multiple scripting engines if required.

To create an ASP script field in an ASP document, use the <% and %> ASP delimiters. For example, the following JavaScript will output "Hello World" in place of the ASP delimited field:

<h1>Today is <% write("Hello World"); %></h1>

Scripting Execution

When a user's browser  requests an ASP document, the default URL handler determines if the page is an ASP document by examining the document's file extension. An ".asp" extension indicates that ASP processing is required. The document is read from the file system or ROM store in a one-pass operation. Text before the ASP delimiters is copied directly to the requesting browser. If ASP delimiters are found, the text between the delimiters is passed to the relevant scripting engine for execution. The resulting text is immediately passed back to the browser and the process continues until the end of the document. This may differ a little to the processing provided by other ASP implementations. Some systems buffer all ASP output and permit scripted iteration over HTML tags. This is not supported as it requires complete in-memory storage of the entire ASP document before returning to the browser.

Scripting Engine Selection

To specify the scripting engine, use the "language=" specifier at the beginning of the ASP script. The language selection is sticky, meaning the language will remain the default language until another "language=" keyword is encountered at the start of an ASP script later in the page. For example:

<% language=javascript write("Query String: " + QUERY_STRING) %>
<% write("JavaScript is still the selected language"): %>

If no "language=" is specified, the default language is JavaScript. You should always specify the language in the <HEAD></HEAD> section of your page for good practice.

See Also

JavaScript, GoForms™, websSecurityHandler, websUrlHandlerDefine