Converting an application to use application.cfc from .cfm

Can't get it to work.

I get on my login page an error.

The requested scope session has not been enabled.  
Before session variables can be used, the session state management system
must be enabled using the CFAPPLICATION tag.  

My application.cfc looks like this

<cffunction name="onApplicationStart" returntype="boolean" output="false">
        <!--- Setup Datasouce --->
        <cfset datasource = ListGetAt(CGI.PATH_INFO, 1, "/") />
        <cfif find(".cfm", datasource)>
                <cfset datasource = listGetAt(CGI.SERVER_NAME, 1, ".") />
        </cfif> 

        <!--- Setup Variables --->      
        <cfset this.version = "2.0.0" />
        <cfset this.name = datasource />
        <cfset this.started = now() />
        <cfset this.filePath = expandPath("..") />
        <cfset this.clientManagement = true />
        <cfset this.sessionManagement = true />
        <cfset this.loginStorage="cookie" />
        <cfset this.sessionTimeout = createTimeSpan(0, 2, 0, 0) />

        <!--- Read Configuration --->
        <cfset this.config = structNew() />

        <!--- Read XML Config File --->
        <cffile action="read"
file="#this.filePath#\config\#datasource#\config.xml" charset="utf-8"
variable="config" />
        <cfset configXml = XmlParse(config) />
        
        <!--- Get Site Config Paramaters --->
        <cfset nodes = xmlSearch(configXml, "//site/*") />
        <cfloop index="i" from="1" to="#arrayLen(nodes)#">
                <cfset this.config[ucase(nodes[i].XmlName)] =
nodes[i].XmlText />
        </cfloop>
        
        <!--- Get Session Config Parameters --->
        <cfset nodes = xmlSearch(configXml, "//session/text()") />
        <cfset this.config.sessionNames = arrayNew(1) />
        <cfloop index="i" from="1" to="#arrayLen(nodes)#">
                <cfset arrayAppend(this.config.sessionNames,
nodes[i].XmlValue) />
        </cfloop>
        
        <cfreturn true />
</cffunction>

Regards
Dale Fraser


Reply via email to