best way to code a basket


I'm just about to start developing my first e-commerce basket and will be using .net 4.

I'm wondering if there is a "standard" way of doing it these days?

Do I use cookies, sessions or something else?

Presumably upon adding an item to the basket it just gets stored with a "basket or session id" and then it is the basket or session id that is available on all pages to pull up the basket?

I'm just looking for a basic overview of the best way to do things to ensure the session can't be lost and where I am not going to come up against issues with cookies disabled etc.

Would appreciate your thoughs and guidance...
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A sessionID (that uses cookies) could be used to track the user and you can store the cart items in the database.

You can take a look at this free open source shopping cart that uses .net 4 :

It's a pretty good system that I am currently using for web stores.

If you want something a little less complex and in Visual Basic,
you could take a look at this book that has good shopping cart code :

You can buy it used for $0.08.
I actually used this book to build an ecommerce website that did very well
and was making about $500,000.00 a year.
Basically a shopping cart can be reduced to several pages all using Session Varaibles, response.redirect("review.aspx"):

Product Page
>>lists details of product and allows users to choose to put in shopping cart
Shopping Cart
>>Shows all products desired to be purchased, allows the user to manage list
Purchase Page
>>usuallty a purchase page that sums up the total dollar amount(thats all the merchat cares about), onClick redirects them to purchase page
    will they enter credit card info.  You would find fields such as email addres, name, dropdownlist  of states, credit card number(you can only use last 4 digits on web form)
Review Page
>> after the user enters details, they can confrim and submit order to merchat processor
On Complete Order page
>>most use an API like, if there are errors, return an error code, other wise reward teh user with a confirmation order page and manage their accounts, ie get free point on database
scm0smlAuthor Commented:
Thanks guys.

I think one of the biggest things I wanted was to make sure there was no chance of the basket being dropped because of a timed out session etc.

I have gone with the idea of storing a basket guid in a cookie and then just  pulling the basket data from the database using that.

Anyone have any issues with that way?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
scm0smlAuthor Commented:
used my own answer...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.