Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

On Exit

Hi experts,
  I like to ask how can I detect in my asp codes when
user left my asp page .
  I would like to delete the users record in the database
  when he leave the page .
0
seahpc
Asked:
seahpc
1 Solution
 
Christian_WenzCommented:
you could try something with the onunload event-handler of the BODY tag, but why not saving (on each page) the "last-seen" time of the user, and (via a server-side process) deleting all entries with a "last-seen" date older than -say 30 minutes.
unfortunately, there is no way of detecting if some completely other page is loaded in the browser - or the browser is closed.
If you use MPS, you can set the delete time for old UIDs on a very low value.
0
 
acsmithCommented:
are we talking about a user leaving a specific page or leaving your site altogether? if it's leaving the site altogether, you can use the session_onend sub in global.asa to do the cleaning up, although depending on how they leave, it may not get called until the session times out (default 20 mins).
0
 
nathansCommented:
What are we trying to do?
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
jbrugmanCommented:
Try JavaScript:
<BODY onUnload="JavaScript:alert('bye')">
if that won't work:
<BODY onUnload="alert('bye')">
or:
<meta http-equiv="Page-Exit" content="what to do"
0
 
Christian_WenzCommented:
seahpc, are you still following this discussion?
0
 
Christian_WenzCommented:
no comments on jbrugman's answer (as it doesn't quite help you with the problem)?
0
 
jbrugmanCommented:
well, it's only to detect when someone extis. Then you can erase that one from the database.
0
 
Christian_WenzCommented:
no offense, but using client-side JavaScript, that's not too easy - and the user could also exit to another page within the system, so I was wondering why seahpc was satisfied with this solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now