Hi Guys,
I am a ColdFusion newbie and this might be a stupid question for the experienced folks:
I have a coldfusion application which uses session to store the logged on user-id (A database check is performed with the user-id /password entered on the login page and if successful, the user id is stored as session.userid) . All the pages in the application check if the session is still valid and there is a userid defined and then display the logged on user id on the top of the page.
Now, the problem occurs when the user opens multiple windows (same browser) and logs on with different user-ids. suppose user opens IE1 and logs in with user1 and then IE2 and logs in with user2. Now, when he navigates to some other page within the application in IE1, user2 is displayed here as well.
I probably should take the user directly to the home page instead of the login page when the user opens the application in IE2, but I want to support simultaneous log-ins by different users on the same machine.
Please help. Any solutions or pointers to web-resources would be appreciated. I tried googling, but did not get anything useful.
Thanks and Regards,
Ankit
7 4836 acoder 16,027
Recognized Expert Moderator MVP
Welcome to TSDN!
By different windows, do you mean of the same instance (e.g. by pressing Ctrl-N) or by starting a new instance (e.g. clicking a quick launch icon)?
Can you show the session checking code?
Welcome to TSDN!
By different windows, do you mean of the same instance (e.g. by pressing Ctrl-N) or by starting a new instance (e.g. clicking a quick launch icon)?
Can you show the session checking code?
Thanks for the reply acoder!!
By different windows, I mean a new instance (a separate window opened through quick launch or program menu). In the login page, once the user authentication is successful, it sets a session variable to 1.
...and then in every page, following is the code which gets executed: -
<cfif not IsDefined("session.init")>
-
<cflocation url="../SessionExpired.cfm" addtoken="No">
-
<cfelseif session.init IS 0>
-
<cflocation url="../SessionExpired.cfm" addtoken="No">
-
</cfif>
-
...and this is where I display the userid -
<cfoutput>Welcome #session.userid#</cfoutput>
-
I hope the problem is clearer now. Please let me know any other specific information would help.
acoder 16,027
Recognized Expert Moderator MVP
You may need to use client variables instead of session variables. See this link for an explanation of the differences.
The Client variables were having a similar effect. I found out where the problem was though. I was using persistent cookies instead of per-session cookies. I added the following code in my application.cfm file and it is working fine now: -
<CFAPPLICATION SESSIONMANAGEMENT="YES" SESSIONTIMEOUT=#CreateTimeSpan(2,0,0,0)# NAME="SRM Project" setclientcookies="no">
-
-
<CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
-
<CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
-
<CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
-
</CFLOCK>
-
Thanks a lot for all the help!
acoder 16,027
Recognized Expert Moderator MVP
Glad to hear that you got it working and thanks for posting your solution. Hope it helps someone.
Post again anytime if you have any more questions.
Hi Ankit,
We are having an application which was developed in coldfusion and if you are trying to browse the same Intranet/Intranet page in the same system it will take the Session of single user.
B'coz The IE will share the profile, i.e if you are accessing the same page by doing ctrl+N then it will take the session of the 1st user only, because their profile will be stored in the Cookies.
You cannot open a same site and login with two different Id's
Cheers,
Moorthy
Hi Guys,
I am a ColdFusion newbie and this might be a stupid question for the experienced folks:
I have a coldfusion application which uses session to store the logged on user-id (A database check is performed with the user-id /password entered on the login page and if successful, the user id is stored as session.userid) . All the pages in the application check if the session is still valid and there is a userid defined and then display the logged on user id on the top of the page.
Now, the problem occurs when the user opens multiple windows (same browser) and logs on with different user-ids. suppose user opens IE1 and logs in with user1 and then IE2 and logs in with user2. Now, when he navigates to some other page within the application in IE1, user2 is displayed here as well.
I probably should take the user directly to the home page instead of the login page when the user opens the application in IE2, but I want to support simultaneous log-ins by different users on the same machine.
Please help. Any solutions or pointers to web-resources would be appreciated. I tried googling, but did not get anything useful.
Thanks and Regards,
Ankit
acoder 16,027
Recognized Expert Moderator MVP
Hi Moorthy,
I see that you've just joined recently. Welcome to TSDN aka. TheScripts.com!
I think Ankit solved the problem as described in post #5. He was using a new instance from Quick Launch or Start->Program Menu, not by pressing Ctrl+N.
Anyway, good to see more members about the place.
Happy posting!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Brian Burgess |
last post by:
Hi all,
Anyone know of any issues with setting the value of a Session object
to the value of a submitted form item via
'Session("mySessionObj")=Request.Form("myFrmElem")' ?
In my case the Session object gets set fine. But when the user links
to another page, the value of the session object is EMPTY.
thanks in advance..
|
by: wafd Alex |
last post by:
hi all
when i use Session object to save a object and then i use
util.redirect(req,url) to redirect a .psp.But in my psp i cann't load
session so i cann't get object from session,help me,thanks
here is my code
..py
s=Session.Session(req)
s=user
s.set_timeout(18000)
s.save()
|
by: Charlie |
last post by:
Hi:
I would like to clear session when user closes browser window by clicking
the "x" in upper right hand corner. Since this is a client side event, how
do I run server code (Session.Abandon()) when user clicks "x"?
Thanks,
Charlie
|
by: Fabrice |
last post by:
Hello,
I 'would like to build a system (based on database, not SqlServer but MySQL)
to permit only one session per user. I'm using a form athentication.
My Solution :
---------------
When a connection is established by a user, I realize an insert in a Table,
named tbLogin with many informations such as idUser, SessionId, Guid, Date,
|
by: Gurunadh |
last post by:
Hi
i've some web user controls in one folder and web pages in some other
folder.
and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to be
displayed in header.
In login user control, the logged in userid was stored in a session.
| |
by: Anthony Smith |
last post by:
I have read the message boards in this group and others. I still have
not been able to pull my obect out of a session and use it. Here is how
I store it in a session:
<?
//Include the UserClass & RoleClass so that we can create a user
object.
require_once("UserClass.php");
require_once("RoleClass.php");
|
by: Anthony Smith |
last post by:
I have read the message boards in this group and others. I still have
not been able to pull my obect out of a session and use it. Here is how
I store it in a session:
<?
//Include the UserClass & RoleClass so that we can create a user
object.
require_once("UserClass.php");
require_once("RoleClass.php");
|
by: anithaapr05 |
last post by:
Hi,
I am creating a session when user successfully login to the site and user gets a form to input some data into database.
Assume that user entered data into some fileds and let the browser ideal and doing some other work in his/her system.
My requrement is, 2 mins before(after 13 mins) of session timeout(I set session timeout as 15 mins in web.config), user should get an alert as" Your session is about to timeout in 2 mins(at...
|
by: oranoos3000 |
last post by:
hi
i d like to when user click the close button all session of the user remover from the system
i user ajax fuction ajax that with onunload is called but result i want dont earn
thanks alot
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |