Solved

Sessions Session_OnEnd.

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
two-way Authentication ASP 3 89
Adding Datediff to staistics page 2 56
Select distinct 25 97
Change visitor's REMOTE_ADDR to server's REMOTE_ADDR 2 29
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…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
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…

813 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

13 Experts available now in Live!

Get 1:1 Help Now