PROBLEM: Browsers Sharing Session Variables

  • Thread starter Thread starter Godot
  • Start date Start date
G

Godot

I have an ASP.NET 1.1 web app that stores a current record ID value in
a session variable so it can be accessed from multiple pages for
inserting/updating of related records.

Unfortunately, if the user chooses FILE/NEW/WINDOW in IE, the new
browser window has the same session ID as the original browser window.
Therefore, if the user retrieves a different record in the second
browser window, the ID in the session variable is changed to reflect
that, but the original browser window is still displaying the old
record. Because the ID value stored in the session is used for
inserts/updates of related records, the actions in one browser window
can (and did) overwrite the data from another record.

Q: Is there some way to prevent this from happening by tracking if a
second window is opened, or something, anything?

Help Mr. Wizard!
 
No, this is how it works, I don't believe there is a way to stop it.

To avoid your problem, don't store these things in session. Use ViewState,
hidden input controls, etc.
 
Marina,

Thanks for the replay. I was afraid that was the case. I had hoped
that my short-sightedness in using session variables for our current
user-level data wouldn't necessitate a rewrite, but oh well....

-- Paul
 
Back
Top