• 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

ASP problem probably similar to JSPs

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My web application is ASP/VBScript based.Clients requirement is that a user cannot/should not login from more than one screen at a given time.I have achieved this by storing userid in Application object, and I check this on every login.It works fine as long as user is logging off normally.When he logs off normally, I am clearing that variable set in Application object(so that it will let him/her in on new login).
But problem is when user closes the browser.In this case I am not able to find a way to clear that application level variable.I have solution which is not elegant - i.e I set the application variable on each page and clear that on unLoad event.Follow this procedure for each page.Isn't it very inelegant solution for a large website..?.Can anyone please suggest a better solution....Is there anykind of event fired only by closure of the browser(UnLoad event is fired by both closure as well as by moving/visting to the next page)
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arvind
Try a session variable. You can set them to expire after a specific amount of time - the default is 20 minutes I think. Each session gets a unique ID when it begins and you can just relate a session ID to the user and track them that way. when they use your logout function/page then you just use the session.abandon method to clear the variables for that session.
As for when they just close down the browser, the session variable will time-out after a certai period of time and then the variables are cleared - you can adjust this timeout period if need be (keep in mind not to make it too short or going to get a cup of coffee for a few minutes will make it time out too). Or in an include file on every page just put your code for the unload event to call the session.abandon. That is probably easier and better in case the user closes the window in error and then tries to log on again right away.
hope that helps
Dave
 
reply
    Bookmark Topic Watch Topic
  • New Topic