• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to invalidate a session when user switches to a different URL ?

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

In my application the user has logged in ( session created ) . Then on the same browser user types : www.google.com . Then when he comes back to my site he is still logged in . I want to invalidate his session .
How this can be done ?
 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use the 'referer' header to get the from url. Supppose the user visits some other site in the same browser and then requests for some page in ur appln., he can do so either by clicking the BACK button or typing ur appln. url in the browser. In the latter case, i guess the 'referer' header would be null. I am not sure about the former scenario tho
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the user switches to a URL that isn't part of your application, you won't know it. You would just have to wait until the session times out.
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


If the user switches to a URL that isn't part of your application, you won't know it. You would just have to wait until the session times out.



No need to wait till session expires. You can use the "referer" header to figure out whether user has left your application and switched to someother application and back with requests for some of your application resources.

I tried with "referer" header and it worked for me.

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey why dont u develop your application in other way..
i mean you better use java script for full screen.
you should not give the access to the user for entering the url and even exit button...


your application must display in full screen mode.....


u even disable right click option




cinux
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the one issue with this is you can easily get back to your resources with back browser button. Ben is there a way to control this?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by saikrishna cinux:

your application must display in full screen mode.....



Only if you want to completely tick off your user base.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would you even want to control it? Frankly it's none of your business if I am running your application and I open another window or another tab to check another site.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul Clapham:
Why would you even want to control it? Frankly it's none of your business if I am running your application and I open another window or another tab to check another site.



Bingo!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Vishnu Prakash:
But the one issue with this is you can easily get back to your resources with back browser button. Ben is there a way to control this?



Not reliably, which is why I said what I did earlier.
If this is a big concern, you might want to shorten the session timeout.

By the way: I agree completely with Paul's comment.
As a user, I would consider any app that tries to control my screen or console to be a poorly written piece of crap.
[ December 09, 2005: Message edited by: Ben Souther ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic