We are developing a shopping cart application.
For every single user session i have to give the user 20 minutes after he adds first product to shopping cart to go to checkout process. If the user adds another product, i have to reset the clock and start 20 minutes from the beginning. ıf user doesnt do anything in 20 minutes, i have to end the session. If user goes to checkout process another clock for checkout process will start. It will be 15 minutes. But if he cancels the checkout process and comes back to store, first clock has to start where it was left..
Hope i am clear.
What approach I can use? Am I gonna use threads, sessions vs..?
Thanks alot.
You would want to use Session state for this. You can set a timestamp in the session everytime the user does something – for instance, adds an item / etc. Before you open any page, you would check the time and see if
If it is greater, then show a message saying that the time expired, else continue on.
On the shopping pages, you can check for 20 minutes, on the checkout pages, check for 15 mins.
Check out this answer too: Session time out with Timer