C# .NET - session between tabs - Asked By anchal dixit on 18-Jan-10 02:13 PM

hi,

I M facing a problem in My Aplication in which i m having many user of diffrent compnay now the problem is if i open account of usre - A of Company 1 i cansee his and his compnay`s record and then i open a new tab in the browser and open Account of user-B of Company 2 in this Situation i want tht when i cllick on the user - A page it shd kick me out to loging page.

But Currentllly it is not working In this manner it just reffresh the page With New User it do not redirect me to the login page i just want it working like yahoo. can u help me  

Hmm, I don't think a new tab in the browser creates a new session - Robbe Morris replied to anchal dixit on 18-Jan-10 07:40 PM

You would have to test that but I think I'm correct.  I did a quick test in my local asp.net development environment and a new session was not created.

session between tabs - mv ark replied to anchal dixit on 18-Jan-10 09:52 PM

When you say you can "open Account of user-B of Company 2", how do you know it is user-B if he is not logged in? What kind of authentication are you using?

In Internet Explorer, session state is shared between the tabs. Check this article for a detailed explanation - http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx

The reason for this behavior is attributed to the single process that runs the tabs and hence sharing the same session state.

ASP.NET 2.0 offered a simpler solution by way of the following config setting

<sessionState mode="InProc" cookieless="UseUri"></sessionState>

This setting basically appends the Session to the URL of the browser, so your typical URL looks like http://localhost/SampleWeb/(S(afdg3ires1ik0lmjm3pkjtzl))/default.aspx    where the highlighted portion manages the session identification.


By this way, one can open multiple tabs and still have different sessions.

Re - Huggy Bear replied to anchal dixit on 19-Jan-10 01:54 AM

When you open an application in multiple tabs of the Internet explorer, the session object will be same for both tabs. That is why when you refresh User A's tab, it brings up the data of User B. 

This behaviour was implemented in IE because, say for example the user is displayed with a list of items and he wants to view each one in different tabs, if the session is not shared then he has to login to each and every tab which will be a big pain for him.

Here is good http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx which does a deep dive into this topic.
thanks - anchal dixit replied to Robbe Morris on 19-Jan-10 12:19 PM

thanks for ur answers

thanks - anchal dixit replied to mv ark on 19-Jan-10 12:19 PM

thanks