Tarzan
Tarzan

Reputation: 4538

How can you remember a user's settings while multple browser instances are open in MVC3?

I am working on an MVC3 application that has book and chapter objects. I use Session to remember settings chosen by each user. An example of a setting is last chapter viewed. It works great when users only have one browser open at a time.

Here is my challenge: Some users open up multiple browser instances at the same time. They use the same credentials to login to each instance. In one browser the last chapter viewed should be different than it is in the other browsers. Currently the session settings for a user overwrite the session settings in the other browser instances. What alternative approach can I use that will allow users to open multiple browsers and still remember the appropriate settings for each?

Upvotes: 0

Views: 412

Answers (1)

Adam Tuliper
Adam Tuliper

Reputation: 30152

Store them in a hidden field on the page. Check out MVCContrib Html.Serialize to write a settings object to the page and rehydrate it on post. You can then just reference each pages object. A cookie doesn't always guarantee a unique instance especially if your browser is sharing sessions.

Upvotes: 1

Related Questions