Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternative of session variable for Shopping cart in ASP .Net MVC

I want to create shopping cart without using session variable to avoid load on Server.

What is an alternative of session variable for shopping cart in asp.net MVC?

like image 201
iChirag Avatar asked Jan 23 '12 15:01

iChirag


2 Answers

Then you need to do this using a cookie.

  1. Generate a unique id of your shopping cart and store the id in a cookie
  2. Create the cart, with the id, in your Database
  3. Load /save cart from Database only if you need

Update

Just to make it clear, your shopping cart unique id should be a System.Guid not an int

like image 158
dknaack Avatar answered Nov 07 '22 10:11

dknaack


thats a good question

i think you can try for storing shopping cart in cookie ..

it will increase performance and provide less load on server ...

like image 31
Milan Mendpara Avatar answered Nov 07 '22 10:11

Milan Mendpara