I want to time out the session with timer, I am implementing a ecommerce project, where I required when user add first product in the cart a timer will start and user add more products in the cart but user did not checkout the cart product within a specific time the cart session is timeout(cart empty). How can acchive this.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Carriage Return (ASCII chr 13) is missing from tex
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
Why would you do this? Instead of using session, store their cart details in the database. That way they can come back tomorrow ( or later that afternoon ) and check out.
Most of the big eCommerce sites never clear your cart. For the very good reason that users might actually come back to complete the process.
To actually answer the question: On server side, when a product is added to the cart save the date time stamp with it.
Whenever any page is loaded, check the date time stamp. If it is passed your acceptable point, simply delete the cart data.