Skip to main content
Inspiring
June 7, 2010
Answered

OnApplicationStart - running table cleanup code ?

  • June 7, 2010
  • 2 replies
  • 771 views

So to hold each session's shopping Cart I use a table called webCart, which includes merchandise_ID, qty , unqiue_session_ref , timestamp

If a user's session expires (20 mins) , the shopping cart rows become obsolete, and at present I have no mechanism to clean this up. I was wondering if OnApplicationStart could do this for me ? It could run some SQL query to check today's datestamp against those in the webCart table and delete rows aged more than 1 hour ?

What do you think ?

This topic has been closed for replies.
Correct answer ilssac

P.S.

OnApplicationStart() would not necessairly run every day, unless you

A) have a low use site that goes long periods with no users

AND|OR

B) set the applicaiton time out to a relatively low time.

The timeout is how long the application has to go WITHOUT BEING USED by anybody or anything (robots from search engines can keep an application alive).  Not how long it has been since the application started.

2 replies

ilssac
ilssacCorrect answer
Inspiring
June 7, 2010

P.S.

OnApplicationStart() would not necessairly run every day, unless you

A) have a low use site that goes long periods with no users

AND|OR

B) set the applicaiton time out to a relatively low time.

The timeout is how long the application has to go WITHOUT BEING USED by anybody or anything (robots from search engines can keep an application alive).  Not how long it has been since the application started.

Inspiring
June 7, 2010

D'Oh!

OnSessionEnd, of course!

Thanks for the info about onApplicationEnd

Inspiring
June 7, 2010

Ian, once checkout is complete is it better to kill the user's session rather than let it expire naturally ?

If so, how ?

ilssac
Inspiring
June 7, 2010

I would suggest OnSessionEnd() is a more logical choice.

Code in that function is ran when the session expires.