• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

Problem with ColdFusion session vars with FireFox

I have an online data entry form which works fine in IE, but not in FireFox.  FireFox does not seem to recognise ColdFusion session variables.

I set up an ultra simple test and it doesn't work.  I have a form  - Test.cfm with this code
<CFSET session.MyDate=CreateODBCDate(Now())>
<CFLOCATION URL="Test2.cfm" addtoken="no">

Open in new window


Test2.cfm looks like this
<CFOUTPUT>
#DateFormat(session.MyDate,"dd/mm/yyyy")#
</CFOUTPUT>

Open in new window


When I run Test.cfm, as expected Test2.cfm opens and displays the date, but when I run the FireFox debugger it tells me
 
<h2>500 - Internal server error.</h2>
  <h3>There is a problem with the resource you are looking for, and it cannot be displayed.</h3>
......
<h1 id="textSection1" style="COLOR: black; FONT: 13pt/15pt verdana">
       Element MYDATE is undefined in SESSION. </h1>

Open in new window


This of course in the data entry form stops things from processing.  How do I fix this problem?
0
jdthedj
Asked:
jdthedj
  • 2
  • 2
1 Solution
 
gdemariaCommented:
Session variables work by using cookies, cookies are written when the page is fully displayed.   So, by doing a CFLOCATION after setting a session variable for the first time, you are preventing the page from writing (by redirecting it to another page)  - so the session variable is never set.

Remove the CFLOCATION and try again.  IF that doesn't work right away, change the name of your CFAPPLICATION to clear things out and try it.
0
 
jdthedjAuthor Commented:
Thanks for the reply gdemaria - As I said, it was a simple test (too simple ;-) ).  I have tried again using a form with a submit button to post to the 2nd page and I still get the same result.
0
 
gdemariaCommented:
Ok, first be sure that your application.cfc file is setup to allow session variables.

Then test setting cookies, be sure your browser will set and retrieve cookies ... same kind of test you're doing with sessions.   Also try other session variable names such as just session.testme and such.

You can also try switching to jsession variables in the CFIDE administrator

One more check, look at your cookies, I have had situations where there were TWO sets of CFIDE cookies set at once, deleting these cookies and restarting the browser fixed the issue.. no idea how two sets of CFID and CFTOKEN cookies were set, but deleting them fixed the problem
0
 
jdthedjAuthor Commented:
Thanks gdemaria - You mentioned jsession variables and I read up about them and turned them on in the Administrator.  The problem has now gone away.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now