0

We have a Review System in place where I work. A manager selects an employee to review, which then sets the EmployeeID as a Session["EmpID"] variable. Now, the manager can enter in the information for the said employee.

Our Issue: When a manager opens another tab or window in the browser (ie. Internet Explorer), searches for a different employee, it sets Employee #2 ID as the Session["EmpID"] variable, over-writing the first one. When the manager switches back to Employee #1 and enters information, they believe they are entering information for #1, however it enters it as #2 since they selected it last.

Does anyone have ideas to prevent this from happening?

Turp
  • 708
  • 3
  • 14
  • 26

2 Answers2

1

When using tabbed browsing you actually use the same asp.net session, and therefore, if you don't uniquely seperate one page's cache from the others, you get the same data.

If your pages uses the session to store data, use a unique identifier (such as a GUID) as a prefix for the key. Store the guid in a hiddenfield or in the ViewState.

Maybe it'll suffice to store the EmpID in the ViewState. Then Tab1 will keep it's value even if Tab2 had another value.

Community
  • 1
  • 1
Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939
1

It sounds more feasible to store the empID in a hidden field/tag in the contents of the page. Save your record based off that string record = span.innerText , because that will be on the page not the session

Jake
  • 1,332
  • 5
  • 23
  • 35