Subject: WroxShoppingCart problem
Posted By: terryh0416 Post Date: 8/29/2006 7:15:18 PM
I have implemented the WroxShoppingCart from the beginning ASP.NET book.  It uses profiles to store cart data and is working fine.  Since that was working, I also stored other info in the profile.  This is an anonymous profile, but I obviously want each user to be discreet.

I am writing a ticket purchasing system, and this is what I found during testing:

- User A selects an event and specifies a quantity of tickets and presses enter
- User B does the same
- User A then refreshes the page, and he all of a sudden has the quantities that User B specified.  It's as if the shopping cart is shared among users.

I am doing this testing on two different machines.  I found that other profile  info was also being shared, but I changed all of that info so that it uses session variables, which is probably best anyway.  Here is the profile section of my web.config:

  <anonymousIdentification enabled="true"/>
      <profile enabled="true">
        <properties>
          <add name="Cart" serializeAs="Binary" type="tep.Commerce.tepShoppingCart" allowAnonymous="true"/>
        </properties>
      </profile>


I'm trying to get ready to go live with this, but this behavior is totally perplexing.  PLEASE, can someone shed some light on this?

Thanks,
Terry
Reply By: terryh0416 Reply Date: 8/30/2006 1:12:50 PM
Anybody have a idea on this?

Reply By: Imar Reply Date: 8/30/2006 1:35:43 PM
Hi there,

I don't have the book, so I don't know how the code for the cart looks like.

However, besides a problem in the profile, this could be a problem with the cart. Are the articles stored in static (shared) variables, or is the cart itself stored in a static member somewhere?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply By: terryh0416 Reply Date: 8/30/2006 2:47:59 PM
I don't think it's a problem with just the cart, which is implemented as a user control.  I used to have other properties defined in the profile that the cart didn't even use, like firstname, lastname, etc., until I just decided to use session variables.  Those also seemed to be shared across all sessions.

I guess I was thinking that since this is the Wrox forum, that someone would be familiar with the shopping cart I'm talking about.  I suppose if nobody has tried to implement it in a production environment (meaning multi-user), then they wouldn't have run into this problem.

Reply By: jminatel Reply Date: 8/31/2006 8:24:37 AM
Terry:
I think your comment about the multi-user production environment may be on to something. As a Beginning book, with the example meant really as a teaching example, yes, it's very likely that most of the book's readers won't have jumped directly from learning their first few ASP.NET examples to a production environment. And, since the forum tends mostly to draw the readers who have had problems with the code and not the 1000s more who got it to work on their own, yes, we're probably short on people actively watching the forums who have done this example in a production setting.

Imar of course is one of the bright shining star exceptions. He's the author on a different book for us (ASP.NET 2.0 Instant Results) but he's also helpful on almost all of the ASP.NET forums for general discussions and other books. While he may not have actually implemented this, he's got the best troubleshooting skills I've ever seen.

Jim Minatel
Senior Acquisitions Editor
Wiley Technology Publishing
WROX Press
Blog: http://wroxblog.typepad.com/
Jim's Book of the week: No book this week - Donate to the Red Cross!

Go to topic 27343

Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184
Return to index page 183
Return to index page 182
Return to index page 181
Return to index page 180
Return to index page 179