Hi all, homework…errr, work question.
We have an application written in VB.NET which was intentionally coded to fail several years ago. I pointed this out, but the lead on this project overruled me because it would be easier to code.
It always saves the session variables in the same “place” in the session, no matter what page you’re on or how many times you’ve visited that page. Therefore lots of overwritten data when you don’t execute the program exactly how it was meant to be executed!
Now the customers are finally discovering what I had been saying all along: that it can and does corrupt data very easily.
I am thinking about replacing the simple session variable with one that will encode a “transaction” hash in the URL, and simply append this hash whenever I am dealing with a session variable. For instance, if the original code was this:
session(“VAR_X”)
I would instead refer to session(xaction_hash & “VAR_X”)
Every time the user will be performing a self-contained business action (similar to filling out a form) in the application, you’d get a new hash. Thus the variables can be stored across screens, but the different actions will not interfere with each other if multiple screens are open or if you actually use your Back button.
My question is, are there better ways of storing session variables than my proposed scheme so that they won’t interfere with each other? The only downside I see to this is that the session might get very large if users keep the application open for a huge amount of time.