Element PREVIOUSPAGE is undefined in SESSION

Posted on 2012-12-26
Medium Priority
Last Modified: 2012-12-27
Hi Experts,

Our website was running fine (www.joe-cool.co.uk/EN/home/home.cfm. any page that you hit now throws an error that is :

Element PREVIOUSPAGE is undefined in SESSION

application.cfc contains this line :
        <!--- variables to identify pages & urls (for navigation) --->
        <cfparam name="Session.previousPage" default="">


it crashes here :
<cfif Session.previousPage EQ "" OR Session.previousPage EQ "#cgi.script_name#">
                        <cflocation url="#CGI.SERVER_NAME#" addtoken="no">
                  <cfelseif REFind("Element ALLPRODUCTS.PRODUCTS is undefined", arguments.exception.rootcause.message) NEQ 0>
                        <cflocation url="#CGI.SERVER_NAME#" addtoken="no">
                  <cfelse> ...

I don't see why is suddenly happening, no changes have been made to anything.

Pelase help,
Question by:adam1h
  • 3
LVL 39

Expert Comment

ID: 38721464
I'm getting a different error:

Could not create connection to database server. Attempted reconnect 3 times. Giving up.
The error occurred in D:\inetpub\vhosts\joe-cool.co.uk\httpdocs\model\products_collection.cfc: line 9
Called from D:\inetpub\vhosts\joe-cool.co.uk\httpdocs\Application.cfc: line 462
Called from D:\inetpub\vhosts\joe-cool.co.uk\httpdocs\Application.cfc: line 449
Called from using password: line -1
Called from using password: line -1

7 : 	<cffunction name="init" access="public" output="yes" returntype="model.products_collection">
8 : 		<!--- retrieve products from database (jcstktabl) --->
9 : 		<cfquery name="q" datasource="joecool_web">
10 : 			select * from jcstktabl order by jcid desc
11 : 		</cfquery> 

Open in new window

Regarding your session error, you should have this set in your onSessionStart function of your Application.cfc file:  

<cfset session.previousPage = "">

Although the cfparam should also work, depending on where it is in relationship with your block of code that is throwing the error.   If would, of course, have to be called before it.  Placing the line above in the onSessionStart method would ensure the order of execution.
LVL 39

Accepted Solution

gdemaria earned 1500 total points
ID: 38722069
The page now errors on undefined TOTALBASKETPRICE

You should define all your session variables in onSessionStart method of your application.cfc file

<cfset session.TOTALBASKETPRICE  = 0>

Tip:  I am not a fan of using session variables to manage your shopping cart, there are too many downsides, I prefer to put the data into the database tables and then just adjust the status of the table to indicate the stage of the order :  in Cart, on Order, processed, shipped, etc...

Keeping the cart in session variables has many disadvantages including:  the cart will completely disappear and the user will have to start over when time-out occurs, you can't easily go from unregistered user's cart to registered user's cart after sign-in (registered users cart gets saved), your customer service cannot see the cart to help a customer on the phone or finish processing the order or apply discounts, etc.  and you have to write twice as much code (you have to write code to manage a session cart and code to manage the order tables).

Author Comment

ID: 38723442
Hi Gdemaria,

Many thanks for your help. The database was deleted by mistake by our hosting company.

We did restart both application and server, recreated the Cfm DSN and it does work fine now.

However, I totally agree with your point of view, this website is old and will soon be replaced by a state of art website, including the arguments you mentionned.

Many thanks
LVL 39

Expert Comment

ID: 38723805
Wow, the hosting company accidently deleted your database!   Glad you survived that!

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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

PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
The video will let you know the exact process to import OST/PST files to the cloud based Office 365 mailboxes. Using Kernel Import PST to Office 365 tool, one can quickly import numerous OST/PST files to Office 365. Besides this, the tool also comes…

624 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