Same Session variables from different computers

Discussion in 'ASP.NET / ASP.NET Core' started by qompro, Jun 10, 2010.

  1. As stated in the title, I don't know how two different computers have access to the same session variables. I have a very simple shopping cart app, so If the person in computer 'A' put any item in their shopping cart, as this is stored in session variables, any one accessing from a different computer has the exact same shopping cart as the one in computer 'A', so that means that they are sharing the same shopping cart.

    Does anybody knows how to solve this problem? I'm I doing something wrong?

    Thanks in advance for your help.

    Francisco
     
  2. If I understand your post/question correctly, you have undesired behavior in your application where data is being shared between users on different computers. If that's correct, this can't be shared session data because that definitely is user session specific. Are you using static variables by any chance? They can cause unexpected and strange results when used in an ASP.NET web application.
     
  3. Thanks a lot for your help CrystalCMS. You lead me to the solution. I made a mistake declaring the class that is holding the shopping cart articles as shared :eek:. These are the consequences of not programming for years :eek:. I'm Sorry.

    Thanks again for your quick replay. You've been very helpful.

    Regards,
     
  4. Cool I'm glad you worked it out. When I mentioned static I was thinking c# but VB.NET shared would cause the same problem e.g. each user gets a unique session instantiated, but when the class that goes into session for the user is static/shared, the end result is every user shares the same session data.

    In some cases this behavior can be useful but mostly it's not ;-)
     

Share This Page