asp.net - session, DB or cookie in eCommerce site -
i creating 1st ecommerce
website. after searching lot confused whether use session
, db
or cookie
.
- some says
session
best because not every user purchases have in cart,db
heavy. - some says
db
should used cart data persist in differentsessions
.
what best choice? sites do?
note: user must login buy something.
edit: that, when user add in cart insert in db temptable have foreign key of userid(user must login buy something). when users checkouts records table deleted , inserted perminent table.
- if user left pc few hours, have login , data there(session problem solved).
- if uses pc, have login , data there(cookie problem solved).
- if removed cookies, data still there(cookie problem solved).
is technique?
personally wouldn't rely on sessions hold basket. customers can quite spend time on site, wander away - perhaps desk. should happen, , have left browser , session expires, cart...
there plenty of other reasons too. maybe started shopping, closed browser, went time , again have start shopping.
what have tendency store cart in database , id cart in cookie. when user comes back, read cookie , cart. can continue onwards then. clear cookie when cart has been purchased, don't allow them edit purchased cart.
i'm sure has it's downsides - cookies disabled etc - though try , cater more masses, rather rare..
just take...
Comments
Post a Comment