|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Session variables not working
It's been awhile since I used session variables,Rick Faircloth 02/27/12 03:15 P Have you enabled session management in the application.cfc?Steve Milburn 02/27/12 03:18 P There's no application.cfc at this point...the onlyRick Faircloth 02/27/12 03:29 P yes you must have an application.cfm/cfc in order to enable sessionRuss Michaels 02/27/12 03:36 P Actually, a cfapplication tag will work fine outside of Application.cfm soJames Holmes 02/27/12 10:56 P I normally use an application.cfc, but this was just a quickRick Faircloth 02/28/12 07:41 A Well, after quickly throwing together an application.cfc,Rick Faircloth 02/27/12 03:36 P In your <cflocation> tag include addtoken="no" attribute to preventAzadi Saryev 02/27/12 09:20 P Thanks for that reminder... it's been years sinceRick Faircloth 02/28/12 07:40 A You will need an application.cfc (or .cfm) for session variables to work.Steve Milburn 02/27/12 03:39 P Correction on my previous post:Steve Milburn 02/27/12 03:41 P Thanks for the reminder!Rick Faircloth 02/27/12 04:02 P Hi Rick,Jay Pandya 02/28/12 12:49 A Thanks, Jay!Rick Faircloth 02/28/12 07:42 A It's been awhile since I used session variables, but this is simple. Why won't this work? session-test.cfm ---------------- <cfset session.name = 'rick'> <cfoutput>#session.name#</cfoutput> <cflocation url="session-test-2.cfm"> session-test-2.cfm ------------------ <cfoutput>#session.name#</cfoutput> I get the error 'Element NAME is undefined in SESSION.' ??? Session variables are specified for use in CFADMIN. Am I missing something REALLY simple or obvious? Rick Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: <cfset session.name = 'rick'> and then output that with: <cfoutput>#session.name#</cfoutput> I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- yes you must have an application.cfm/cfc in order to enable session variables. On Mon, Feb 27, 2012 at 8:28 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- Actually, a cfapplication tag will work fine outside of Application.cfm so technically this isn't true. Of course it makes sense to use Application.cfm or Application.cfc. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 28 February 2012 04:36, Russ Michaels <russ@michaels.me.uk> wrote: ----- Excess quoted text cut - see Original Post for more ----- I normally use an application.cfc, but this was just a quick "proof-of-concept" that I threw together to test something. Actually, a cfapplication tag will work fine outside of Application.cfm so technically this isn't true. Of course it makes sense to use Application.cfm or Application.cfc. -- Shu Ha Ri: Agile and .NET blog http://www.bifrost.com.au/ On 28 February 2012 04:36, Russ Michaels <russ@michaels.me.uk> wrote: ----- Excess quoted text cut - see Original Post for more ----- Well, after quickly throwing together an application.cfc, I can see that it is necessary. It attached the CFID and CFTOKEN to the URL. There's no application.cfc at this point...the only two pages involved are what's in this email. Is enabling session management in an application.cfc necessary for session management to work? As you can see below when I use: <cfset session.name = 'rick'> and then output that with: <cfoutput>#session.name#</cfoutput> I get 'rick'... But that's on the same page. Would that work but not session variables between pages with session management being enabled in application.cfc? Rick Have you enabled session management in the application.cfc? On Mon, Feb 27, 2012 at 3:14 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- In your <cflocation> tag include addtoken="no" attribute to prevent CFID/CFTOKEN vars from being appended to the url. I'll also suggest you set your server to use J2EE sessions in CF Administrator, if you have not done so already. Azadi ----- Excess quoted text cut - see Original Post for more ----- Thanks for that reminder... it's been years since I've even used cflocation! My how knowledge, unused, is fleeting... In your <cflocation> tag include addtoken="no" attribute to prevent CFID/CFTOKEN vars from being appended to the url. I'll also suggest you set your server to use J2EE sessions in CF Administrator, if you have not done so already. Azadi ----- Excess quoted text cut - see Original Post for more ----- You will need an application.cfc (or .cfm) for session variables to work. In your example, your <cfset session.name = 'rick'> was actually stored in the variables scope on that page as variables.session.rick, and not actually in the session scope. That is why it was not available on the other page. On Mon, Feb 27, 2012 at 3:28 PM, Rick Faircloth <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- Correction on my previous post: The variable was stored in variables.session.name (not variables.session.rick)... but you probably knew what I meant.. ;-) ----- Excess quoted text cut - see Original Post for more ----- Thanks for the reminder! Rick Correction on my previous post: The variable was stored in variables.session.name (not variables.session.rick)... but you probably knew what I meant.. ;-) ----- Excess quoted text cut - see Original Post for more ----- <Rick@whitestonemedia.com>wrote: ----- Excess quoted text cut - see Original Post for more ----- Hi Rick, When you are using session variables and you want to get its value in other page after using cflocation then you need to enable seclientcookies true in cfapplication tag. More description you can read on http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_5.html read Setclientcokies description. Thank You Jay Pandya ----- Excess quoted text cut - see Original Post for more ----- Thanks, Jay! Rick Hi Rick, When you are using session variables and you want to get its value in other page after using cflocation then you need to enable seclientcookies true in cfapplication tag. More description you can read on http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_a-b_5 .html read Setclientcokies description. Thank You Jay Pandya ----- Excess quoted text cut - see Original Post for more -----
|
June 20, 2013
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||