How to implement ASP.NET Shopping Cart?

Arief picture Arief · Jun 2, 2009 · Viewed 10.4k times · Source

I tried to find similar questions but with no luck. Anybody can give me an idea how to build a Shopping Cart in ASP.NET the best practice way?

I know a wayto use Session but I think it would be painful to maintain the Session across pages. I've heard also to use Profile.

So which one do I have to choose? Which one is the best and most recommended solution?

Answer

Josh picture Josh · Jun 2, 2009

I've built many using the following methods:

  • Create a Database Table Called ShoppingCart
  • Store a Your ASP.NET session as Foreign Key
  • Either Add a ProductID per row or store a list of ProductIDs per row. This usually depends on if you have meta data you need to store about each product, such as quantity or size. The more meta data, the easier it is to manage if you store one product per row.

A good book that covers e-commerce is the APress book "Beginning ASP.NET 2.0 E-Commerce".