Solved

Sessions Session_OnEnd.

Posted on 2004-04-30
4
446 Views
Last Modified: 2008-02-26
Morning Experts.

I am trying to update a database when a user exists my application.  Problem is, sometimes users will not log out, they will leave the site, and the session will expire (after 20 minutes).

Now my question is, when the session_OnEnd is run, meaning a session is expired after timeout, or session.abandon, will  the session_OnEnd know what session is ending?

Meaning could I do the following.

SUB Session_OnEnd
StrSQL=" UPDATE alerts SET ShowAlert = '0' WHERE ShowAlert = '1' and ownerid ="'& Session("StrOwner")&"' "
End SUB

So the session that is about to be ended, can I pass the session StrOwner and update the database before the session has ended?

P.S.
I know this isnt how you would call the SQL script, and that alot of information is missing to do this correctly, I am leaving this information out to try to give you a clear and general idea of what I am trying to do.

Thanks to everyone.
0
Comment
Question by:eberglund
  • 2
  • 2
4 Comments
 
LVL 21

Expert Comment

by:ap_sajith
ID: 10962089
SUB Session_OnEnd
StrSQL=" UPDATE alerts SET ShowAlert = '0' WHERE ShowAlert = '1' and ownerid ='" Session("StrOwner")&"'"
End SUB

You can do that... The only problem is that session_OnEnd is not very reliable ie, it need not be triggreed everytime.

Cheers!!
0
 
LVL 21

Accepted Solution

by:
ap_sajith earned 250 total points
ID: 10962111
>>Now my question is, when the session_OnEnd is run, meaning a session is expired after timeout, or session.abandon, will  the session_OnEnd know what session is ending?

It would know which session is ending... .

Cheers!!
0
 
LVL 1

Author Comment

by:eberglund
ID: 10962325
Yes I have had problems with the session_OnEnd in the past.  What would be a better solution, short of writing  a script that checks session times every minute, and kills the session after x time period, where x is the set timeout.

I should also note that my application will only have a few (less then 30-50) people logged in at a time.



So up to the point beofore the sub routine ends (End sub causes the sub to execute correct), the session will keep in tack its session variables, along with knowing what session it is about to end.
0
 
LVL 1

Author Comment

by:eberglund
ID: 10963037
Ya know, the application works the same way with session_onstart, dont know why I didnt think of this before, so it wont be as difficult then I thought.  thanks though.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now