8 Replies - 987 Views - Last Post: 18 May 2013 - 06:58 PM Rate Topic: -----

#1 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Session Variables issue

Posted 18 May 2013 - 03:32 PM

Howdy Folks,

Got a bit of a problem here. I've created my own shopping cart class which inherits from a list of products. All was going well, but I needed the cart object to be persistent across page loads for each session so I added it to the Session and on each postback I reload the cart. All was going well till I decided to test my web application on another computer and it seems they are both sharing the same session which is quite mind boggling for me especially after I was under the assumption Session was separate for all users. Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: Session Variables issue

#2 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,833
  • Joined: 12-December 12

Re: Session Variables issue

Posted 18 May 2013 - 04:34 PM

The Session is not shared so it must be some other coding error, possibly connected to static variable(s) which have application scope (available to all users).
Was This Post Helpful? 0
  • +
  • -

#3 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Re: Session Variables issue

Posted 18 May 2013 - 04:49 PM

View Postandrewsw, on 18 May 2013 - 05:34 PM, said:

The Session is not shared so it must be some other coding error, possibly connected to static variable(s) which have application scope (available to all users).


That's the assumption I was under. The only Session variable I have across the whole application is this one, and I have zero Application variables. It's over 9000 lines of code and I've honestly got no idea where to even begin searching for the source of this issue. I typically load the cart session variable in the load event, and update it just before posting back. I've tested from my phone outside my network, and from inside my network and still the same issue. I've even tried changing the key of the session variable to the session id just to guarantee that the key was unique and that the variable would only be accessed from that key, and yet still it comes even when the key is definitely different. It does't seem at all like this should be possible given the design of Session state. Thanks for the help so far.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,833
  • Joined: 12-December 12

Re: Session Variables issue

Posted 18 May 2013 - 05:23 PM

I can only advise you to try and disregard the session variable - I think it may be distracting you from the real issue.

Make good use of the debugging features of VS: I'm sure you can narrow down the areas of interest below 9000 lines :dozingoff:
Was This Post Helpful? 0
  • +
  • -

#5 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Re: Session Variables issue

Posted 18 May 2013 - 05:30 PM

That's what I've been up to for the passed hour or so. No conclusion yet but I have managed to find an article pertaining to a similar issue. Somehow others say that in my cart class and any classes designed this way, the declaration of shared variables has made my cart class shared so to speak, and because of that now all my sessions are using the same instance of the cart. Now this only seems to apply to objects being added into the Session.

This post has been edited by trevster344: 18 May 2013 - 05:33 PM

Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,833
  • Joined: 12-December 12

Re: Session Variables issue

Posted 18 May 2013 - 05:59 PM

Well this may sound flippant, but try to describe the problem without using the word Session ;).

Anyway, good luck!
Was This Post Helpful? 0
  • +
  • -

#7 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Re: Session Variables issue

Posted 18 May 2013 - 06:13 PM

Haha will try. I'm going to give up on this approach for now and will focus on a database oriented approach instead.
Was This Post Helpful? 0
  • +
  • -

#8 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3480
  • View blog
  • Posts: 11,833
  • Joined: 12-December 12

Re: Session Variables issue

Posted 18 May 2013 - 06:34 PM

This article about session state may be of interest.
Was This Post Helpful? 1
  • +
  • -

#9 trevster344  Icon User is offline

  • The Peasant
  • member icon

Reputation: 224
  • View blog
  • Posts: 1,505
  • Joined: 16-March 11

Re: Session Variables issue

Posted 18 May 2013 - 06:58 PM

Thanks Andrew! That was just what I needed and I will definitely be taking this into consideration. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1