22 October, 2005

First ASP Page

0 Comments

Written by Jason Davies Topics: ASP

Just so you know how to get started with ASP, we'll go through a simple example step by step.

ASP Files

ASP files have an extension of .asp and are interpreted on-the-fly by your Web server (usually IIS or PWS). Your ASP files should be placed somewhere in a subdirectory of your Web root directory (often C:inetpubwwwroot).

Example ASP Code

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.




    
        ASP Display Date Example
    

    
        

ASP Display Date Example

The current date is <%= now() %>

]]>

Here the script element is used to indicate the primary scripting language being employed. This element also tells the Web server to execute the script code on the server rather than the client with the runat attribute. This can be abbreviated as:

]]>

Notice how the ]]> is used to delimit the code that is run. The ]]> is actually a shorthand for ]]>.

0 Responses to “First ASP Page”

Leave a Comment