Skip to main content
Inspiring
May 1, 2006
Question

Difference between Application Scope and Session Scope

  • May 1, 2006
  • 2 replies
  • 1451 views
I have been strugling with disappearing sessions. Can some one explain to me the big difference b/w Session Variables
and Application Variables? Below is my code
<cfif IsDefined("url.referer")>
<cflock scope = "Session" timeout = "30" type = "Exclusive">
<CFSET session.referer= #url.referer#>
</cflock>
</cfif>
The main purpose if to track where user is coming from and passed through the Url below is what I have in my application.cfm
<cfparam name= "Session.referer" default="">
But for some reason when the user clicks on a form that is stored in another folder the session variables disappears.
This topic has been closed for replies.

2 replies

May 3, 2006
please read the cfml reference.
BKBK
Community Expert
Community Expert
May 2, 2006
The standard variable is cgi.http_referer, not url.referer.

May 3, 2006
The differences are:

session scope variables are ONLY available to that SESSION. So you would use them for information that ONLY pertains to the current browser session. User IDs, User preferrences, etc. It is the same type of information that you would store in a COOKIE, but is on the CF Server instead of the CLIENT COOKIE. User A and User B get different data each via the sesion scope. user A can not read session scope varaibles set by user B. Another advantage of session scope variables is the ability to store complex data types like arrays, querys and invoked cfcs. The session scope variable lasts as lok as the session time out is set in the administrator, or the application tag.

APPLICATION scope is a SHARED scope that is accessable to all scripts within an application as defined by the application tag. user A and user B on your appliation get the same data from the application scope. Application variables last as long as the timeout in the administrator or application tag is set to.