Replicate cache across multiple CF servers
Hi All, Need help with replicating cache across clustered CF8 servers. I have an application running on single server and i was caching some commonly used data in Application scope. There is a logic tied in my caching object such that when data changes the cache is rebuild. Now we are moving to clustered server environment with 3 three servers. If the cached data changes I need to replicate them across other servers. I want the other servers to go to database and get new data. How can I achieve this. ~| 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:358895 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Multiple application in webroot with different sessions
You will need to make sure each of the session cookies specify a path attribute otherwise the user will loose sessions when going from app to app (if you have the session fixation patch enabled). This will also allow you to have unique session ids for each app. You can do this by writing the CFID/CFTOKEN cookies yourself in onSessionStart (example: http://www.petefreitag.com/item/764.cfm) or if you are on CF10 you could try this.sessioncookie.path (but that may not work, looks like they may not allow you to set the path this way). The session timeout is internal to CF so even if the session cookies are not expired it doesn't mean that the session is still valid. So even without all of the path attribute set you can still have unique timeouts, but the session can only be valid for one app at a time. -- Pete Freitag - Adobe Community Professional http://foundeo.com/ - ColdFusion Consulting Products http://hackmycf.com - Is your ColdFusion Server Secure? http://www.youtube.com/watch?v=ubESB87vl5U - FuseGuard your CFML in 10 minutes On Tue, Nov 20, 2012 at 12:25 PM, Uday Patel udayjpatel2...@gmail.comwrote: Thank you very much, your suggestion worked ~| 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:353276 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Multiple application in webroot with different sessions
Did you assign different names to the two applications? On Mon, Nov 19, 2012 at 9:48 PM, Uday Patel udayjpatel2...@gmail.comwrote: yes the application names are different for all sites ~| 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:353265 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Multiple application in webroot with different sessions
Hi, I am trying to create a website which has more than one application in the same webroot. and each application should have its own different sessionid and session timeouts. Can I achive this. For example: I created a test website like uday.local on my local machine. whose location is /websites/uday. /websites/uday --- (This is the webroot). /websites/uday/Application.cfc Than I created two application under my webroot. /websites/uday/App1 /websites/uday/App1/Application.cfc and /websites/uday/App2 /websites/uday/App2/Application.cfc Application.cfc in webroot have default session timeout of 20 min. For App1 i set session timeout to 1 minute and for App2 i set session timeout to 10 min. Application name for all the application is different. I noticed that the session id remains same for all the application as well as the session timeout for all the applications is 20 min. I can change the sessionid, but what is important is the session timeout. I want session timeout different for all applications. Any ideas, help, solution, everything appreciated. ~| 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:353255 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Force logout a user
Uday, Can you expand on the reason for the single machine requirement? Folks here may be able to provide an alternate direction or solution if we understand your reason for this restriction. Hi Byron, Gathering some information about users machine was a thought that came in my mind while i was implementing this solution. But this was not my purpose. My aim was to have a user logged in on ONLY one machine at any given point. Thanks Regards, Uday lead coldfusion developer ~| 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:351881 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Force logout a user
Hi, I want to force logout a user if he logs in on another machine. I am using CF9 and session scope to track user user logins. what are the possible ways of achieving this. Thanks in advance Hi, Thank you folks for your responses and suggestions. I spend my weekend playing around with this app on my personal network. This is what I did. maybe this helps someone. If you guys have some tips tricks suggestions, please let me know. I appreciate all you folks taking time to read and post messages. Objective : User should be able to login on only one machine. If he tries to login from another machine, his old session should be terminated. I am using cf sessions for the purpose of tracking user. Solutions provided: check user's IP address : This might not work very well. what is the user is inside a network, or behind a proxy. I know my ISP in canada keeps changing the IP address on my home network. As Cameron mentioned CFID/CFTOKEN and that this is one single best way to determine unique logins. and i agree with this. But what if user clears his cache in that case his browser will get new CFID/CFTOKEN from cf server. Roadblock: While i was playing around with this. I started thinking is there any way that we can get some information about user's machine, like his mac address(since we cannot rely on ip address, cfid's, coz these might change). I googled around with no luck and than came back to my app. But this is one thing that I will explore later on. What I did: I already had logins table in my db wherein i was making entry each time user logs in. I added two more columns here: logout_date and logout_by. These columns will be updated when a user logs out. He can click on logout button or he will be logged out on session end. I also created dead_session_array and put this in application scope. Here I will keep adding all dead sessions. (will explain this later) Scenario 1: User logs in on machine A. entry is made in logins table but logout_date and logout_by is empty. (If user clicks on logout i update these two columns. If session ends I have some code in onsessionend in application.cfc which will update these two columns. when coding inside onsessionend, make sure you read CF documentations. since onsessionend is a self triggered CF event only applicaiton and session scope is available inside via applicationscope and sessionscope). Now suppose user goes to machine B. CF will provide him with new CFID/CFTOKEN (sessionid). when he tries to login I will check in logins table and show him a message that this user already has a session open on another machine. Provide him with a button (something like 'logout old session and continue logging on this machine') When he clicks on this button I will update the logout_date and logout_by columns in logins table for this user and I will take this sessionid(of machine A which i got form logins table that i recorded when he logged on machine A) and I will add this sessionid in application.dead_session_array. So use succefully logs in on mahine B, I will make new entry in logins table with this new login data. Now when he goes to machine A and tries to do something. I will check if application.dead_session_array contains any sessionid. If it does and the sessionid matches with sessionid of machine A. logout this user simply by clearing his session scope. There was a good link about session scope by Ben Nadel http://www.bennadel.com/blog/1847-Explicitly-Ending-A-ColdFusion-Session.htm. clearing session scope does not mean that user logs out. It depends how you design your application. In my case I simply put useObj in session scope. clearing session scope will remove userObj from session scope. But people have diffferent ideas and different ways of doing this. Scenario 2: User logs in on machine A. I make an entry in logins table with logout_date and logout_by columns empty. Now he clears his cache. clicks on any link on my page. CF will again provide him with new sessionId. This puts me again in the same situation like scenario1 I have a user whose logout_date is empty that means his session is still on. Provide him with a button which when clicked will update the logout_date column. So in a nutshell this is the trick that i used. this way i hit DB only once during login, if there are any invalid or dead session put them in application scope so that we can deal with it later. Notes: sessionid is combination of CFID and CFTOKEN ~| 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:351876 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Force logout a user
Hi, I want to force logout a user if he logs in on another machine. I am using CF9 and session scope to track user user logins. what are the possible ways of achieving this. Thanks in advance ~| 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:351850 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Getting coldfusion server name
Also might be in server scope. Try dumping that out. On May 28, 2012 6:03 AM, Andrew Scott andr...@andyscott.id.au wrote: Thanks all for your reply, I will check it out. ~| 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:351347 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Getting coldfusion server name
Hi, Is there a way to get machine name where coldfusion is running. I know in CGI scope i have server_software, server_protocol but i need the name of the machine ~| 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:351333 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Coldfusion fusebox 5.5 sessioning
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
Re: Coldfusion fusebox 5.5 sessioning
Check the cookies on windows to see if the CFID/CFTOKEN are changing between pages. On 3/26/12 11:43 PM, Uday Patel wrote: Thanks Jonah, yes the cookies are changing. this.setclientcookies was false, changed it to true and now its working good. AAh what a waste of my night. ~| 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:350558 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm