• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Preventing Two Instances of Same Web App

 
Ranch Hand
Posts: 2202
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to prevent the user from starting two instances of the same app(on the same computer)?

I think it is strange that if I start one instance of the app and log on. Then I start a second instance(on the same computer) and log on to that one also then log off of the second one it clears any session attributes of the first instance app also.
 
Marshal
Posts: 28010
94
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically, no. If the two instances are in the same brand of browser (e.g.. both in IE or both in Safari) then they may share the same session on the server. Or they may not, under some circumstances. And if they are in different brands of browser (e.g. one in Firefox and the other in Opera) then they will have different sessions on the server.

Generally trying to prevent the user of a web application from doing something which appears perfectly reasonable to him or her is a fool's errand. It's better to assume that it's going to happen and to deal with it on the server.
 
Steve Dyke
Ranch Hand
Posts: 2202
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Basically, no. If the two instances are in the same brand of browser (e.g.. both in IE or both in Safari) then they may share the same session on the server. Or they may not, under some circumstances. And if they are in different brands of browser (e.g. one in Firefox and the other in Opera) then they will have different sessions on the server.

Generally trying to prevent the user of a web application from doing something which appears perfectly reasonable to him or her is a fool's errand. It's better to assume that it's going to happen and to deal with it on the server.



This issue does not seem to be a problem when the same user uses to different machines for the same app even though both are IE.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Dyke wrote:This issue does not seem to be a problem when the same user uses to different machines for the same app even though both are IE.



Correct, The session information is generally passed to the client through cookies. The first time the user reaches the server the browser does not have a 'jsessionid' cookie, so the server creates one and sends it back to client as part of the response. The browser holds on to the jsessionid cookie, and the next time it makes a request it sends the cookie back and the server knows to associate that request with the same session as before.

In the situation where the user creates multiple windows to the same website using the same machine (and browser) then the browser typically will 'share' the cookie between all the open windows - so all requests get the same jsessionid cookie and are associated with the same session.

In the situation where the user logs in from two different computers, even with the same browser brand, there is no (automatic) way to share that jsessionid across computers. So on both machines the first request goes without a session, the server generates a new jsessionid for each of the two independent clients, and therefore both clients are treated independently.
 
Steve Dyke
Ranch Hand
Posts: 2202
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So not only am I going to have problems with multiple sessions of the same app on one machine but different apps that ping the same server and use the same attributes such as log on and user authinication? All of my apps use the same basic code structure and content for common activities.
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic