Well I usually set all my session variables to 0 in Application.cfm and once a user has logged in reset them to the required DB values
(userId, companyId) etc then in pages that require say UserId I dump the UserId down to request scope and use the request scope value like Select username where userId =#request.userId# I think the question is turning into what SPECIFIC function does the request scope serve when I could just dump the variable down to something like UserId without using the request scope you see? ----- Original Message ----- From: "Damian Watson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 05, 2003 11:51 AM Subject: Re: [ cf-dev ] Request scope > This has posted a couple of times recently... can say when and why you would > use this? > > Cheers > d > > > ----- Original Message ----- > From: "Robertson-Ravo, Neil (RX)" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, November 05, 2003 9:35 AM > Subject: RE: [ cf-dev ] Request scope > > > > Not sure what your question is..but then again I have had hardly any sleep > > ;-) but if it's a way of copying back and forth between the request and > > session scope..this should work (and there are even easier ways!) > > > > <cfparam name="attributes.action" default="session2request"><!--- required > > ---> > > > > <cfswitch expression="#attributes.action#"> > > <!--- add session variables to the request scope ---> > > <cfcase value="session2request"> > > <cflock scope="SESSION" type="READONLY" timeout="15"> > > <cfloop collection="#session#" item="key"> > > <cfset request[key] = session[key]> > > </cfloop> > > </cflock></cfcase> > > > > <!--- add request variables to the session scope ---> > > <cfcase value="request2session"> > > <!--- remove request variables that should not be added to > > the Session scope ---> > > <cfset excludeList = "hideScript,hideTimeScript"> > > <cfloop list="#excludeList#" index="i"> > > <cfset StructDelete(request, i)> > > </cfloop> > > > > <cfloop collection="#request#" item="key"> > > <cflock scope="SESSION" type="EXCLUSIVE" > > timeout="15"> > > <cfset session[key] = request[key]> > > </cflock> > > </cfloop></cfcase> > > > > <cfdefaultcase> > > The "action" ATTRIBUTE you have passed in is invalid. > > <cfabort></cfdefaultcase> > > </cfswitch> > > > > > > > > > > > > > > -----Original Message----- > > From: Matt Horn [mailto:[EMAIL PROTECTED] > > Sent: 05 November 2003 09:35 > > To: [EMAIL PROTECTED] > > Subject: [ cf-dev ] Request scope > > > > Hi > > > > for as long as I have been writing Cold fusion code I have done this: > > <cflock scope="session" timeout="10"> > > <cfset request.userId= session.userId> > > <cfset request.productionhouseId = session.productionhouseId> > </cflock> > > but everything works fine without the request scope > > > > <cflock scope="session" timeout="10"> > > <cfset userId= session.userId> > > <cfset productionhouseId = session.productionhouseId> </cflock> > > > > > > so my question is this > > > > Am I correct in setting session variables down to Request scope > > > > or will the other way work just as well? > > and if so .. why even have a request scope? > > > > Matt *Newbie > > > > > > > > |\--------------------/| > > Matt Horn > > Web Applications Developer > > Ph:+2782 424 3751 > > W: http://www.matt-horn.org > > E:[EMAIL PROTECTED] > > |\--------------------/| > > > > -- > > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > For human help, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
