asp.net sessions

windows

Guest
Thanks to anyone who has responded to my previous posts, very useful.

Hopefully this won't be construed as spamming because i asked a similar question in the PHP forum but this time i need asp expertise. The PHP question was:-

"I've developed a shopping cart with PHP and MySql which works fine. Once an item is added to the cart it is withdrawn from the database instead of leaving the withdrawing till the checkout stage. This avoids shoppers all choosing an item that may be the last in stock. The only problem is if the shopper that has the item in their cart decides not to buy and leaves the site without removing the item from the cart or the session times out, the item hasn't been purchased but also hasn't been put back in the database. What can i do to get round this?"

I had some very useful advice which leaned towards withdrawing the item at checkout for simplicity reasons. If i had the time i might venture into the other recommendation of writing a script to check the cart if the session timed out or the browser closed without a purchase and replenish the database with unpurchased items.

What i want to know is does asp.net offer any different sultions to this problem or would i be left with the same options?Moved to .NET forum.I agree that checking to make sure the item is still in stock at checkout would be the easiest solution. In asp.net there is something called a global.asax which houses some application wide variables and methods. You can put some code in there that will be called on session end that will restore any items that were withdrawn from the db by any one user. So with asp.net you can do exactly what you want to do. The only trouble is the asp.net sessions tate is buggy, it rarely lasts for the set time you want it too and those events that are supposed to fire on session end rarely fire when the session ends, rather there is a substantial delay.well , i would just add a field to database , and not removed the item from the database when the user clicks on buy.

this was the field (like:"IsInCart?") just tell you if the user put it in the cart,
you can have another field (like:"IsBought?") , when the user buy the product...

good luck...but youd still have to move items from the incart field back to the stock field whenever a session expires.
 
Back
Top