ASP Examples

Basics

Write text with ASP

Add HTML to text

Variables

Declare variables

Declare arrays

Loop to generate HTML headings

Use VBScript to create a time-based greeting

Use JavaScript to create a time-based greeting

Date/Time Functions (VBScript)

Dates and Times

Get the name of the day

Get the name of the month

Get today's month and day

Countdown to year 3000

Calculate N days from today

Format date and time

Is this a date?

Other Functions (VBScript)

Uppercase or lowercase string

Remove leading and trailing spaces from a string

How to convert a string?

Round a number

A random number

Return a specific character from a string

Replace specific characters in a string

Return a specified number of characters from a string

Procedures

Call a subroutine using VBScript

Call a subroutine using JavaScript

Call subroutines using VBScript and JavaScript

Forms

Form using method="get"

Form using method="post"

Form with radio buttons

Cookie

Welcome cookie

Response Object

Use ASP to write text

Use HTML tags to format text in ASP

Redirect users to different URLs

Display a random link

Control caching

Clear the cache

Terminate a script during processing and return a result

Set how many minutes to cache the page in the browser before it expires

Set the expiration date or time for the page cache in the browser

Check whether the user is still connected to the server

Set content type

Set character set

Request Object

Pass parameters via URL in a link

A simple application of the QueryString collection

Get information from a form

Get more information from a form

A simple application of the Form collection

How to use information from a form

Get more information from a form

Form with radio buttons

Form with checkboxes

How to obtain the visitor's browser type, IP address, or more

Get all requested server variables

Welcome cookie

Total number of bytes sent by the user

Session Object

Return SessionID

Session timeout

Server Object

When was this file last modified?

Open and read a text file

Homemade click counter

FileSystem Object

Does the specified file exist?

Does the specified folder exist?

Does the specified drive exist?

Get the name of a specified drive

Get the name of the parent folder of a specified path

Get the file extension

Get the base name of a file or folder

TextStream Object

Read a text file

Read a portion of a text file

Read a line from a text file

Read all lines of a text file

Skip a portion of a text file

Skip a line of a text file

Return the number of lines

Get the number of columns

Drive Object

Get the amount of free space on the specified drive

Get the remaining space capacity on the specified drive

Get the total capacity of the specified drive

Get the drive letter of the specified drive

Get the drive type of the specified drive

Get the file system information of the specified drive

Is the drive ready?

Get the path of the specified drive

Get the root folder of the specified drive

Get the serial number of the specified drive

File Object

When was the file created?

When was this file modified?

When was this file accessed?

Return the attributes of the specified file

Dictionary Object

Does the specified key exist?

Return an array of all items

Return an array of all keys

Return the value of an item

Set a key

Return the number of key/item pairs

AdRotator Component

Simple AdRotator example

Browser Capabilities Component

The type, capabilities, and version of each browser visiting the website

ContentRotator Component

Content Rotator Component

Content Linking Component

Content Linking Component

Content Linking Component 2

Other extensions