shopping cart concept

Discussion in 'ASP .Net' started by Paulo, May 16, 2008.

  1. Paulo

    Paulo Guest

    Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
    concept on my application? When the user clicks add item, it will be stored
    on some storage format, I dont know what is the term: temp/global DataSet,
    etc... and it should be read on other web-form to checkout the items...

    Can you point me to the right direction?

    Thank you very much!
     
    Paulo, May 16, 2008
    #1
    1. Advertising

  2. Paulo

    Paulo Guest

    Mark, what do you think about this solution? Good or bad?

    http://www.sitepoint.com/article/net-shopping-cart-datatables

    Thank you very much!

    "Mark Rae [MVP]" <> escreveu na mensagem
    news:...
    > "Paulo" <> wrote in message
    > news:%...
    >
    >> Hi, beginner on asp.net 2.0 C# VS 2005, how can I use the shopping cart
    >> concept on my application? When the user clicks add item, it will be
    >> stored on some storage format, I dont know what is the term: temp/global
    >> DataSet, etc... and it should be read on other web-form to checkout the
    >> items...

    >
    > Basically, you have several choices depending on how you've designed your
    > web app, and what resources you have at your disposal...
    >
    > As you've discovered, the information in the shopping cart needs to be
    > persisted (i.e. "remembered") across multiple pages. Therefore, you can't
    > use ViewState. However, it's vital that different concurrent users don't
    > get their shopping carts mixed up, so you can't use the Application object
    > either.
    >
    > Does your web app use a back-end database? If so, then you can use that to
    > store the shopping cart. This will also have the advantage that users
    > could "save" their cart and come back to it later. Some people like to
    > offer this facility...
    >
    > Alternatively, even if your web app does use a database, you might prefer
    > to persist the cart information in the Session object. This is very simple
    > to do. Obviously, if you use the Session object, then any information
    > stored in it will be lost when the Session ends either because the user
    > has logged out and you've torn down the Session in code, or because it has
    > timed out...
    >
    > A third alternative would be to store the cart data in a cookie. However,
    > this would obviously not work if the user has disabled cookies in their
    > browser - some users do this for (supposed) security reasons.
    >
    > Personally, I use the Session object for shopping cart. I use a
    > Dictionary<int, int> generic for this. The Dictionary is keyed on the
    > product's unique identifier, and the value is the number of items
    > purchased. This has the advantage of keeping the object persisted in
    > Session as small as possible.
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Paulo, May 16, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GeorgeF

    Perl Shopping Cart Scripts

    GeorgeF, May 21, 2005, in forum: Perl
    Replies:
    1
    Views:
    3,264
    James T
    May 22, 2005
  2. Bruce W...1

    Secure shopping cart example?

    Bruce W...1, Aug 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    606
    Bruce W...1
    Aug 27, 2003
  3. Mark Fox

    Shopping Cart Component Suggestions

    Mark Fox, Nov 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    384
    Jacob Yang [MSFT]
    Nov 4, 2003
  4. John
    Replies:
    1
    Views:
    370
    George Shubin
    Nov 7, 2003
  5. Paul Hobbs

    Shopping Cart - database vs session

    Paul Hobbs, Dec 4, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    2,769
    Jaxon
    Dec 4, 2003
Loading...

Share This Page