Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top