Solved

Sessions Session_OnEnd.

Posted on 2004-04-30
4
445 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

757 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

22 Experts available now in Live!

Get 1:1 Help Now