views:

213

answers:

3

Hey there, I'm making an application that makes use of session variables. I have created a class "HistoryLine" and another called "HistoryLineCollection" with a list of "HistoryLine"s in it. I then save the instance of the HistoryLineCollection to the session like this:

Session["HistoryLines"] = hLines;

The problem is that when I watch this on another computer, I see the same list! I thought sessions where client unique? I have looked into the sessionState and maybe the SessionID is cloned or something, but I just can't see it. Anyone has an idea?

A: 

Check the code that creates the list to put into session. You are probably creating the same list for each session.

Matthew
I am using the same class to generate the list of items, if that's what you mean. I set a session variable to hold the list of items and getting it the same way, with a cast.
miccet
+1  A: 

No, the asp.net session is not shared. One way for this to happen is browsing the app on one computer, and then using the link on another computer (say you im it to someone). In that scenario, if you happen to have cookies disabled, the session ID is on the Url. The other person would be on the same session. If that is not the case, then really have a look at the classes you are using, specially anything marked as static.

eglasius
I overlooked that my list was shared. Making it non shared and instantiate objects did the trick!
miccet
+1  A: 

Are the members of the the class that is created and then put into Session somehow static (aka shared)?

Andrew Robinson