Avatar of adam1h
adam1h
Flag for Belgium asked on

Element PREVIOUSPAGE is undefined in SESSION

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
ColdFusion Language

Avatar of undefined
Last Comment
gdemaria

8/22/2022 - Mon
gdemaria

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.
ASKER CERTIFIED SOLUTION
gdemaria

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
adam1h

ASKER
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.
gdemaria

Wow, the hosting company accidently deleted your database!   Glad you survived that!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy