Solved

Element PREVIOUSPAGE is undefined in SESSION

Posted on 2012-12-26
4
355 Views
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,
Adam
0
Comment
Question by:adam1h
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 39

Expert Comment

by:gdemaria
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.
0
 
LVL 39

Accepted Solution

by:
gdemaria earned 500 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).
0
 

Author Comment

by:adam1h
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
Adam.
0
 
LVL 39

Expert Comment

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

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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