How to implement ASP.NET Shopping Cart?

10,436

Solution 1

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".

Solution 2

Seems a bit vague question, I presume you asking how to build the whole application which is hard to answer in brief

Googling pulled up an excellent article:

http://net.tutsplus.com/tutorials/other/build-a-shopping-cart-in-aspnet/

also look at this:

http://codebetter.com/blogs/david.hayden/archive/2005/03/22/60166.aspx

Regarding session state, from my experience, sessionstate is useful on a single server set up, but if you thinking ahead and need scalability to web farm scenario, additional issues arise with serialising data. This is needed when storing session state in sql server. adding a lot of complexity to your application.

Share:
10,436
Arief
Author by

Arief

I am a web developer based in Jakarta, Indonesia. I am specializing in .NET technologies, currently working as a SharePoint Developer.

Updated on June 22, 2022

Comments

  • Arief
    Arief almost 2 years

    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?

  • Arief
    Arief almost 15 years
    Actually not the whole application, just the shopping cart. The URLs you gave me indeed bring up some ideas, but I still want to know if there is a standard way of implementing this. thanks
  • Aqeel
    Aqeel over 11 years
    it helped me, but i need jquery or ajax based Cart, is there any thing helpful for me?
  • cmroanirgo
    cmroanirgo over 11 years
    You can also use Session state on smaller sites. See this thread on maintaining session state
  • user1544428
    user1544428 about 4 years
    I know this is old, but many years ago I used the net.tutsplus.com link to build a company sales center -- used internally only -- and ended up building a ton of code around it. It works fine but stores items in session. If people don't save before exiting the cart, it loses everything. Millions of dollars of products have been sold through this cart over the years, but it is a fatally flawed design. If I had everything to do over again, I would have never, ever used that design. Especially now, when people are exiting by closing browser tabs. It's caused me quite a few headaches. Do not use.