0

I'd like to stop IE8 from sharing my sessions in one of two ways (or both if possible):

  1. Through configuring the browser to always do this (so I can force my users to configure their browsers in this way).

  2. Through code in my web application.

Thanks.

husainnz
  • 259
  • 2
  • 6
  • 3
    Curious why you want to do this. – Raj Kaimal May 02 '10 at 23:55
  • possible duplicate of http://stackoverflow.com/questions/368653/how-to-differ-sessions-in-browser-tabs - there are others, but personally I think this is generally a bad idea. – Dean Harding May 03 '10 at 00:01
  • I think that you have to design your program actions in a different way and it is not the ie8 session sharing the problem. – Aristos May 03 '10 at 06:45
  • I am implementing an enterprise application which inevitably has to use the session to store things on the UI while taking the user through a series of wizard steps. I wouldn't want my users to open a link to another application page in a new tab/page and have them screw their existing session by doing other stuff. Why the negative feel about turning it off? – husainnz May 03 '10 at 12:15
  • if you're specifically talking about a wizard then that's really a different question. You don't want to turn off session state overall but you want to store the data related to this particular set of wizard pages. In that case, I'd recommend using `ViewState` instead of session. Simple solution. – Samuel Neff May 03 '10 at 15:03

1 Answers1

0

Instead of storing data in the session directly, create a custom tab-level session upon demand and store everything there. When a new request for any page comes in, create a Dictionary<string, object> to use as the tab-level session and then store it in the session based on a unique key. Pass this unique key from page to page either in the viewstate or url.

However, you need to prevent users from opening links in a new tab (which will make them mad, so this really isn't a good thing to do anyways). To do that make sure all links are postbacks only.

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182
  • Sounds like a lot of work - what is the point of my ASP.NET session state if I can't use it?? – husainnz May 03 '10 at 12:16
  • @husainnz, if you don't want to use sessions the way they're meant to be used then you need to do some work on your own. – Samuel Neff May 03 '10 at 15:02