Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgrading from CF 5 to CF8 and undefined session

Status
Not open for further replies.

jjdonate

Programmer
Oct 30, 2003
1
FR
Hi everybody,

First sorry for my poor english (i'm french... nobody's perfect [wink]).

My problem is that an old application, running on CF5 without problem, doesn't work on a new (OS Win 2003 sp2, IIS 6, CF8) machine. I precise that all cookies are accepted by the browser (IE6 but the same on FF3.6).

The problem is that session management seems not to work.

In the login folder
********************************************************
Application.cfm
Code:
<CFAPPLICATION NAME="xxxxxxx" SESSIONMANAGEMENT="yes">
<CFSET Variables.DSN="yyyyyyyyy">

Index.cfm

a form with UserName and PW

ActionIndex.cfm

UserName and PW verification and if ok
Code:
<CFLOCK TIMEOUT="10" TYPE="EXCLUSIVE" SCOPE="SESSION"> 
     <CFSET Session.LoggedIn = "1"> 
     and other session variables affectation...
</CFLOCK>
then
<cflocation url="/user foldername/file name.htm">

In user foldername
********************************************************

Application.cfm
Code:
<cfapplication name="xxxxxxx" sessionmanagement="yes">
<CFSET Variables.DSN="yyyyyyyyy">
<CFLOCK TIMEOUT="10" TYPE="READONLY" SCOPE="SESSION">
<CFIF NOT IsDefined("session.LoggedIn")>
 <SCRIPT LANGUAGE="JavaScript">
 {window.close();}
 </script>
 <CF_LOCATION URL="/appfolder/Login/index.cfm">
</CFIF> 
</CFLOCK>


file name.htm

A frameset with 3 cfm files using the session variables etc...

When i log with verified UserName and PW the second Application.cfm throw me back to index.cfm as if session.LoggedIn where undefined.

If a delete the loggedIn verification the 3 cfm files in file_name.htm frameset stop at the first reference of a session var used.

I saw in the CF8 documentation

Note:
If you set session variables on a CFML template that uses the cflocation tag, ColdFusion might not set the
variables. For more information, see TechNote 22712 at
[URL unfurl="true"]http://kb2.adobe.com/cps/181/tn_18171.html[/url]

It was exactly what hapened to me. I tried every workarounds they suggest without any success !! (javascript redirection, CF_Location, CFHeader, meta refresh...)

I have an other application built in the same model that seems to work with session variable without problem.

What can I do ?? stay in CF5 ?

Thanks in advance for any suggestion.

Best regards.
 
jjdonate,

do you need the second application.cfm?

Logically for the session to remain the same both <cfapplication ...> tags are identical (especially the name attribute!), and as the "/user folder/" is under the original folder the application.cfm it should work for all sub-folders!

if removing the application.cfm in the "/user folder/" is not an option you can always try to force the browser to complete it's request by trying something like this:

Code:
	<script language="javascript" type="text/javascript">
		function doWrite() {
			document.write('<scr'+'ipt> document.location = \'./user%20folder/index.htm\';</scr'+'ipt>');
		}
		doWrite();
	</script>

When we migrated from CF5 to CF8 we had similar issues with embedded files before a redirection, but our embedded file had only one block of <cfscript>...</cfscript> and this code resolved the issue, but i'm not 100% sure it is required.

Personally if I was you I'd just remove all application.cfm files and write one application.cfc
you can use the "onRequestStart" function to check for the session, and perform a re-direct from there (if the user is not already on the login script of course).

B.

We never fail, we just find that the path to succes is never quite what we thought...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top