macromedia.coldfusion.cfml_general_discussion
[Top] [All Lists]

Re: sessions aren't working :(

Subject: Re: sessions aren't working :(
From: GArlington
Date: Wed, 03 Oct 2007 04:11:29 -0700
Newsgroups: macromedia.coldfusion.cfml_general_discussion

On 2 Oct, 02:35, "ToaLhii" <webforumsu...@xxxxxxxxxxxxxx> wrote:
> The error now shows up as : [q]CFLock cannot be used to lock the application 
> or
> session shared scopes without these scopes being established through the use 
> of
> the CFApplication tag. If you want to use the session scope you need to enable
> session management. Application and/or Session variables must also be enabled
> in the ColdFusion Administrator.[/q](Yes they are enabled in the Admin)
>  [Q]<cfcomponent output="true">
>
>         <cfset this.name = 'edited'>
>         <cfset this.SessionManagement=true>
>         <cfset this.clientManagement=false>
>         <cfset this.setclientcookies=true>
>
>         <cffunction name="onApplicationStart" access="public" 
> returntype="boolean"
> output="false">
>                 <cfscript>
>                 application.vars = structnew();
>                 application.vars.ds = 'edited';
>                 application.vars.title = 'edited';
>                 application.vars.compdir = 'edited';
>                 application.vars.psddir = 'edited';
>                 application.fusebox.mode = 'development';
>                 </cfscript>
>                 <cfreturn true>
>         </cffunction>
>
>         <cffunction name="onRequestStart" access="public" returntype="boolean"
> output="true">
>                 <cfargument name="page" required="yes" type="string">
>
>                 <cfset var twosecs = CreateTimeSpan(0, 0, 0, 2)>
>
>                 <cflock scope="application" timeout="#twosecs#" 
> type="readonly">
>                         <cfset request.app = duplicate(application.vars)>
>                 </cflock>
>
>                 <cflock scope="session" timeout="#twosecs#" type="readonly">
>                         <cfif isStruct('session.vars')>
>                                 <cfset request.sess = duplicate(session.vars)>
>                         </cfif>
>                 </cflock>
>
>                 <cfreturn true>
>         </cffunction>
>
>         <cffunction name="onRequestEnd" access="public" returntype="void" >
>                 <cfset var twosecs = CreateTimeSpan(0, 0, 0, 2)>
>
>                 <cfif isDefined('request.sess')>
>                         <cflock scope="session" timeout="#twosecs#" 
> type="exclusive">
>                                 <cfset session.vars = duplicate(request.sess)>
>                         </cflock>
>                 </cfif>
>
>         </cffunction>
>
>         <cffunction name="onSessionStart" access="public" returntype="void"
> output="false">
>         </cffunction>
>
>         <cffunction name="onSessionEnd" access="public" returntype="void"
> output="false">
>                 <cfargument name="sessionScope" required="yes" type="struct">
>                 <cfargument name="applicationScope" required="false" 
> type="struct">
>         </cffunction>
>
>         <cffunction name="onError" access="public" returntype="void">
>                 <cfargument name="exception" required="yes">
>                 <cfargument name="eventname" type="string" required="yes">
>                 <cfdump var="#arguments.exception#">
>         </cffunction>
>
>  </cfcomponent>[/Q]

I presume you get your error from your "onError" execution. Add dumps
of "this" and "application" and check what is there...


<Prev in Thread] Current Thread [Next in Thread>