2

I have an MVC 4 based web app. Where I provide 2 login types, 1. Employee and 2. Customer. With Customer login, I present a dashboard and other stuff, about his orders, etc. With Employee login, I allow the employee to search for his customers and provide the ability to carry out certain customer specific tasks.

It is possible that, an employee after login can seach for a number of customers and fetch each of their details in multiple browser tab(s).

I am having difficulty in maintaining state for each tab, if I put the unique identifier of the customer in session, as the next subsequent request will overwrite the session!

To solve this, I have relied on a (dirty) viewbag based solution, where I set the customer number in viewbag in every view.

Is there an elegant solution to solve this? a known design pattern?

Numan
  • 3,918
  • 4
  • 27
  • 44
  • Working this around could be tricky as some browsers share cookies among tabs. – Wiktor Zychla Jun 05 '13 at 08:49
  • The last part of my [answer here](http://stackoverflow.com/a/13036936/453277) is probably applicable and [this answer](http://stackoverflow.com/a/14285965/453277) shows how to implement unique session keys (albeit in Web Forms). Basically, you use a unique ID that is tied to a particular page (in the URL or in a hidden field). You then tie all session information to that single ID. – Tim M. Jun 05 '13 at 08:51

0 Answers0