p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Variable Scopes

Message #1 by "John Farrar" <john@s...> on Wed, 4 Apr 2001 16:12:51
ASP has these objects


Application variables apply to all sessions of the application
Session variables apply to the current session

you set/retreive values like this

Session("var") = 1

myvar = Session("var")

(same syntax for application)

Request allows you to retreive form elements or querystring elements in the

myvar = request.querystring("field1")

myvar = request.form("field1")

Response gives you access to the response that it being created

the most useful methods are

Response.write "Text" (Writes a string to the response stream)

Response.redirect "another.asp" (redirects the request to another file -
can't be used after any content has been written)

Server represents the server

most useful methods are



See any of the Wrox books on ASP for a more detailed explanantion.

-----Original Message-----
From: John Farrar [mailto:john@s...]
Sent: Wednesday, April 04, 2001 5:13 PM
To: Code Clinic
Subject: Variable Scopes

We are converting an Application Services Technology to ASP from 
ColdFusion and need to understand how to accomplish variable scoping in 
ASP. In CF (ColdFusion) we have the following scopes (server, application, 
session, request, and attributes) we can start any variable with the scope 
and that sets it's availability. Application.myVar would be available to 
all sessions in the application. Request and Attributes are available for 
the current call to the server. Attributes is available to the current and 
included scripts. Request is available to all components called for the 
current page request. This allows us to do simultaneous processing and use 
the request scope for variables global to the web call, and the attributes 
for isolating variables to local groups.

How ... or can we do this in ASP? If not... how about ASP.Net?

Scottish Enterprise Network

  Return to Index