First ASP Page
Just so you know how to get started with ASP, we'll go through a simple example step by step.
<h2>ASP Files</h2>
<p>
ASP files have an extension of <code>.asp</code> and are <strong>interpreted on-the-fly</strong> by your Web server (usually IIS or PWS).
Your ASP files should be placed somewhere in a subdirectory of your Web root directory (often <code>C:inetpubwwwroot</code>).
</p>
<h2>Example ASP Code</h2>
<p>
Here is a simple example written in VBScript which displays the current date on a Web page dynamically (it changes every time it is accessed).
Notice how most of the file is just HTML.
This is because ASP is usually just HTML with extra programming logic code added.
</p>
<pre class="asp"><![CDATA[<script language="VBScript" runat="Server">
<body>
<h1>ASP Display Date Example</h1>
<p>
The current date is <%= now() %>
</p>
</body>
]]>
<p>
Here the <code>script</code> element is used to indicate the primary scripting language being employed. This element also tells the Web server to execute the script code <strong>on the server</strong> rather than the client with the <code>runat</code> attribute. This can be abbreviated as:
</p>
<pre class="asp"><![CDATA[<@ language="script_language">]]></pre>
<p>
Notice how the <code><![CDATA[<% ... %>]]></code> is used to delimit the code that is run.
The <code><![CDATA[<%= now() %>]]></code> is actually a shorthand for <code><![CDATA[<% response.write now() %>]]></code>.
</p>