So I am having problems saving collections unique across tabs/browser (tabs really).
Using static variables to store data after the callback in ASP didn’t work so well because all browsers could read from it and modify the variables.
Using session variables didn’t work so well because while it successfully made the collection unique across browsers – it wasn’t unique across tabs. So one Mozilla tab could modify a the collection in a session variable (the collection changes) – the user will get a nasty surprise when using another Mozilla tab when accessing the collection again – unfortunately the SAME collection – something like a dirty read.
So the problem is – how can I make collections across tabs/browsers stateful but uniquely stateful so that each can have their own unique collection and can modify it freely.
The problem as I see it here is one tab continually makes an ajax request which always recreates the controller object which means it will never be unique.
Another idea was to save a reference to this collection in javascript – and then pass this reference back and forth during each request – The problem is how can I do it without serializing/deserializing which kind of defeats the point of just saving the reference 🙁
Any ideas are welcome.
Methods that didn’t work: Session, Application/Static (haven’t tried Application but it seems to behave the same way).
Will ViewState work? It doesn’t seem to save data however :'(
Replace the default route with a custom route which adds a GUID to the uri. And use that GUID to load the session.
I’ve made an example in my blog just for you: http://blog.gauffin.org/2012/02/get-a-unique-session-in-each-browser-tab/