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 different sessions.

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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -