Copy link to clipboard
Copied
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 ?
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.
Copy link to clipboard
Copied
I would suggest OnSessionEnd() is a more logical choice.
Code in that function is ran when the session expires.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
D'Oh!
OnSessionEnd, of course!
Thanks for the info about onApplicationEnd
Copy link to clipboard
Copied
Ian, once checkout is complete is it better to kill the user's session rather than let it expire naturally ?
If so, how ?
Copy link to clipboard
Copied
You can't expire the session, but you could delete all the data stored in the session scope. StructClear() or StructDelete() would be ways to do it whole sale.
Whether it is a good idea or not, depends on the requirements of your system. But it is often done.