Hi,
This is my first ever post. I have been programing coldfusion for more than 3
years now.
I was working on a web application for almost a year now, and than i decided to
use fusebox5.5 (no xml).
Problem: loose session variables on relocation.
I have user object : user.cfc
I have singleton object: userGateway.cfc to fetch user details from DB
I have singleton object: userService.cfc below is the code of userService.cfc
<cfscript>
component displayname="UserService" output="true"
{
public UserService function init()
{
private.cfo =
application.objectfactory.create('commonfunction');
return this;
}
//get current user from session
public ANY function getCurrentUser()
{
if(StructKeyexists(session,'userObj'))
return session.userObj;
else
return '';
}
//set current user to session
public VOID function setCurrentUser(obj)
{
var localObj = arguments.obj;
var tmp = '';
try{
//if(!StructKeyexists(Session,'userObj')){
//StructInsert(Session,'userObj',duplicate(localObj));
//}
//else{
Session['userObj'] = DUPLICATE(localObj);
//}
tmp = localObj.get('user_id');
client.user_id = tmp;
}
catch (ANY e){
private.cfo.sendmail(htmlcontent = cfcatch, msg =
"Problem adding user to the session", Subject="Error in userservice.cfc");
}
}
//delete current user from session
public VOID function deleteCurrentUser()
{
if(StructKeyexists(session,'userObj'))
StructDelete(session,'userObj');
}
}
</cfscript>
All i am trying to do here is when a person logs in i put the userobject in
session scope. THis works good but as soon i click on some other link (i
removed the redirect) userobject goes away from the session scope. I also put
the user_id in client scope to see what happens and even the user_id from
client scope disappaeared.
on my MAC firefox this works good. But on windows xp(firefox, IE), MAC safari
the session scope looses userobj.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:350556
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm