Solved

cookies and application.cfm

Posted on 2004-10-18
3
189 Views
Last Modified: 2013-12-24
Hi,
  Can anyone tell me what code to place in application.cfm to make cookies expire when clients browser is closed or client does a refresh? Also need to know how to set up sesesions and NOT use cookies. I am using dynamic data through Flash and CF is placing cookies on the clients PC that cause new/refreshed data to not show up.
If someone would take the time to give me more "control" items code related to this, to use in application.cfm  , I will add more points. This refresh is a big problem. I can't get the web site to work without using cookies and refreshing data is a big problem. I need to refresh the whole page, not just Flash.
Thanks,
Steve
0
Comment
Question by:SteveDallas
3 Comments
 
LVL 35

Accepted Solution

by:
mrichmon earned 200 total points
ID: 12338927
The only way to set up sessions and not use cookies is to pass the CFID and the CFTOKEN around in every URL of your site.  You can do this useing URLTOKEN

To make a cookie expire when the browser is closed - this can only work with memory only cookies.  You would use jsession (a setting in the CFAdministrator.

First of all you cannot place any code in the application.cfm to make cookies expire on browser close.  Application.cfm does not run then.  It runs on the LOAD of each page.

I do not think that you can expire cookies on the hard-drive (also known as file-cookies) upon browser close.

The best method would be to set up sessions like this :

<cfapplication
      name="MyApplication"
      sessionmanagement="yes"
      sessiontimeout="#CreateTimespan(0,0,60,0)#"> <!--- 60 minute session timeout --->

Then store information into the session scope instead of into the cookie scope
0
 
LVL 21

Assisted Solution

by:pinaldave
pinaldave earned 50 total points
ID: 12339290
Hi SteveDallas,

http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/tags-pa3.htm#wp1097308
Some of the answer you can find from mrichmon's comment.

Also regarding when you click on refresh the cookies should expire, this is not possible usually as that is not good application. Sometime many reason one has to refresh the page and if cookies are expired user might find problem. In our office T1 gets down momentarily due to network problem so if the page is not loaded IE waits for while and reloads it automatically if it has not got proper response from the server.

Even though if you want on refersh.. this is what I would do. I will keep the variable at the end of the page to set. so when the page is properly loaded it will set the variable and if the variable is set then I will delete all the cookies and expire the session variable.

Regards,
---Pinal
0
 
LVL 2

Author Comment

by:SteveDallas
ID: 12393345
Hi,
  I solved this a couple of ways. I set CF to not use cookies. I use sessions. With this application I must refresh the page, having the cold fusion database query run at every refresh. We are using live, dynamic data. I will open another question to deal with passing a variable out from Flash Actionscript to CF to look for, in a loop.  THe thing that really stabilized this application was:  In Flash Actionscript - Create blank variables and create instances from those variables as the first thing the code does, before every attempting to load the external file and to put this in an external *.as file. That got rid of the intermittent "undefined" error. Thanks for your comments.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Suggested Solutions

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now