Solved

Sessions Session_OnEnd.

Posted on 2004-04-30
4
452 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

687 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