If I'm building a high-traffic site, and I don't want to use session for the front pages. Is it possible to enable session only for pages in certain subfolders, while sharing the same Application scope?
Thanks!
If I'm building a high-traffic site, and I don't want to use session for the front pages. Is it possible to enable session only for pages in certain subfolders, while sharing the same Application scope?
Thanks!
I don't believe so. My understanding is that session settings are per-application. However, if you are simply using the application scope to store configuration variables (or similar) then you could create two application.cfm/application.cfc files that include a shared file with the config data.
It's possible, but be careful, as you could have things leak out that you don't want to. Take the following file structure:
wwwroot
-- Application.cfc
-- index.cfm
-- Subfolder
---- Application.cfc
---- index.cfm
Application.cfc:
<cfcomponent>
<cfset this.name = "foobar" />
<cfset this.applicationtimeout = CreateTimeSpan(1,0,0,0) />
<cfset this.sessionmanagement = false />
<cffunction name="onApplicationStart">
<cfset Application.Started = Now() />
</cffunction>
</cfcomponent>
index.cfm:
<cfdump var="#Application#">
<cfdump var="#Session#" />
Subfolder/Application.cfc
<cfcomponent extends="Application">
<cfset this.sessionmanagement = true />
</cfcomponent>
Subfolder/index.cfm
<cfdump var="#Application#">
<cfdump var="#Session#">
A dump in the root index.cfm will show no values for cfid, sessionid, cftoken, etc. However, a dump in Subfolder/index.cfm will show all of the usual session information. Both index.cfm files will dump the same started value in the Application scope.
Dan