Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

New session per browser tab/window in ASP.NET MVC 3 app

I need to have a new session per browser window/tab. I am aware of the fact that ASP.NET assigns one session per process. I am also aware that browsers share this session between all open tabs/windows of the app. However, I need to come up with a way to create a new session for a new tab/window.

Cookieless session-state is not an option also. I already looked at that. I am looking to keep URL's clean.

I looked at the following solutions. 1) asp.net - session - multiple browser tabs - different sessions?. This solutions suggests using IsPostBack property, which is not available in MVC. 2) https://sites.google.com/site/sarittechworld/track-client-windows. This one looks very complex and I don't fully understand the javascript magic that is happening in it. I don't want to put in a solution that I don't understand. Also, I am not fully aware of any security holes that this solution may create.

Can someone point me in the right direction?

like image 667
Nachiket Mehta Avatar asked Mar 06 '12 23:03

Nachiket Mehta


People also ask

What is session in ASP NET MVC?

What is session in Asp.net MVC. The Web is stateless, In simple word Session is a temporary memory location where we can hold small amount of data for a certain period of time during user visit on any website, Session is a HttpSessionStateBase object. Asp.net provide three different way to store session data. InProc, StateServer and SQLServer

What is the difference between earlier version of ASP NET and session?

There is no difference in session management with earlier version of asp.net, if you are using Asp.net aspx of earlier version, session in asp.net remain the same.

Is it possible to not share session variables between different browser tabs?

Show activity on this post. Is it possible to not share Session variables between different browser tabs? I want to keep one login session between tabs, but don't want to share information between opened tabs. is it possible? Show activity on this post. No. That is not possible with the session cookies, which are controlled by your browser.

What is httpsessionstatebase in ASP NET?

The Web is stateless, In simple word Session is a temporary memory location where we can hold small amount of data for a certain period of time during user visit on any website, Session is a HttpSessionStateBase object. Asp.net provide three different way to store session data.


1 Answers

The only way to achieve this is to append the session id in the url which is what cookieless sessions are intended to do. Unfortunately you seem to have ruled out this possibility due to the ugly urls it produces.

like image 111
Darin Dimitrov Avatar answered Oct 26 '22 23:10

Darin Dimitrov