HOME

ASP Tutorial
ASP HOME
ASP Introduction
ASP Install
ASP Syntax
ASP Variables
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa

ASP Objects
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error

ASP FileSystem
ASP TextStream
ASP Drive
ASP File
ASP Folder
ASP Dictionary

ASP Components
ASP AdRotator
ASP BrowserCap
ASP Content Linking
ASP Content Rotator

ASP Quick Ref

Examples/Quiz
ASP Examples
ASP Quiz Test

ADO
ADO Introduction

Resources
ASP Resources
Online Degrees
Please visit our sponsors !

ASP Variables

previous next

A variable declared outside a procedure can be changed by any script in the ASP file. A variable declared inside a procedure, is created and destroyed every time the procedure is executed.


Examples

Create a variable
Variables are used to store information. This example demonstrates how to create a variable, assign a value to it, and insert the variable value into a text.

Create an array
Arrays are used to store a series of related data items. This example demonstrates how you can make an array that stores names.

Looping through headers
This example demonstrates how you can loop through the 6 headers in HTML.

Time-based greeting using VBScript
How to write VBScript syntax in ASP. This example will display a different message to the user depending on the time on the server.

Time-based greeting using JavaScript
How to write JavaScript syntax in ASP. This example is the same as the one above, but the syntax is different.


Lifetime of Variables

A variable declared outside a procedure can be accessed and changed by any script in the ASP page in which it is declared.

A variable declared inside a procedure is created and destroyed every time the procedure is executed. No scripts outside that specific procedure can access or change that variable.

To make a variable accessible to several ASP pages, declare it either as a session variable or as an application variable.

Session Variables

Session variables store information about one single user, and are available to all pages in one application. Common information stored in session variables are username and userid. To create a session variable, store it in a Session Object.

Application Variables

Application variables are also available to all pages in one application. Application variables are used to hold information about all users in a specific application. To create an application variable, store it in an Application Object.


previous next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page


Search W3Schools:


What Others Say About Us

Does the world know about us? Check out these places:

Dogpile Alta Vista MSN Google Excite Lycos Yahoo Ask Jeeves


We Help You For Free. You Can Help Us!


W3Schools is for training only. We do not warrant its correctness or its fitness for use. The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2002 by Refsnes Data. All Rights Reserved


Validate How we converted to XHTML Validate

Domain Name Registration
Domain Name
Registration & More!



Your own Web Site?

Read W3Schools
Hosting Tutorial



$15 Domain Name
Registration
Save $20 / year!



Advertise
at W3Schools

Only 0.5 CPM



SELECTED LINKS

University Online
Master Degree
Bachelor Degree


Web Software

The Future of
Web Development


Jobs and Careers

Web Security
Web Statistics
Web Standards


PARTNERS

W3Schools
TopXML
VisualBuilder
XMLPitstop
DevelopersDex
DevGuru
Programmers Heaven
The Code Project
Tek Tips Forum
ZVON.ORG
TopXML Search