473,508 Members | 2,032 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session Problem - Different User-Id in different IE windows.

5 New Member
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
Oct 22 '07 #1
7 4821
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?
Oct 22 '07 #2
agoyal2
5 New Member
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.

Expand|Select|Wrap|Line Numbers
  1.  <cfset session.init=1> 
...and then in every page, following is the code which gets executed:

Expand|Select|Wrap|Line Numbers
  1. <cfif not IsDefined("session.init")>
  2.     <cflocation url="../SessionExpired.cfm" addtoken="No">
  3. <cfelseif session.init IS 0>
  4.     <cflocation url="../SessionExpired.cfm" addtoken="No">
  5. </cfif>
  6.  

...and this is where I display the userid

Expand|Select|Wrap|Line Numbers
  1. <cfoutput>Welcome #session.userid#</cfoutput>
  2.  
I hope the problem is clearer now. Please let me know any other specific information would help.
Oct 22 '07 #3
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.
Oct 22 '07 #4
agoyal2
5 New Member
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:

Expand|Select|Wrap|Line Numbers
  1. <CFAPPLICATION SESSIONMANAGEMENT="YES" SESSIONTIMEOUT=#CreateTimeSpan(2,0,0,0)# NAME="SRM Project" setclientcookies="no">
  2.  
  3. <CFLOCK SCOPE="SESSION" TYPE="READONLY" TIMEOUT="5">
  4.      <CFCOOKIE NAME="CFID" VALUE="#SESSION.CFID#">
  5.      <CFCOOKIE NAME="CFTOKEN" VALUE="#SESSION.CFTOKEN#">
  6. </CFLOCK>
  7.  
Thanks a lot for all the help!
Oct 24 '07 #5
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.
Oct 24 '07 #6
itsmoorthy
4 New Member
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
Jan 10 '08 #7
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!
Jan 10 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2398
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...
0
1592
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...
3
2566
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())...
2
8978
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...
2
1477
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...
2
1424
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...
2
23786
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...
7
20880
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...
4
7864
oranoos3000
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
0
7227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7127
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...
0
7331
Oralloy
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,...
0
7391
jinu1996
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...
1
7054
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7501
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5056
isladogs
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...
0
3204
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.