New session for tab / browser window in ASP.NET MVC 3 application

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

Cookieless session-state is also not a parameter. I already looked at that. I want the URL to be clean.

I reviewed the following solutions. 1) asp.net - session - multiple browser tabs - different sessions? . These solutions use the IsPostBack property, which is not available in MVC. 2) https://sites.google.com/site/sarittechworld/track-client-windows . This one looks very complicated, and I don't quite understand that javascript magic is going on in it. I do not want to offer a solution that I do not understand. In addition, I am not fully aware of any security holes this solution might create.

Can someone point me in the right direction?

+4
source share
2 answers

I created a NuGet package called ASP.NET MVC Conversational Session. Here you will find additional information: http://blog.micic.ch/net/asp-net-mvc-conversational-session

I released the first version yesterday. Check out the demo code or download the demo solution and let me know if there are any improvements. :)

EDIT: Default: "Identifier" is passed to the URL when you use the appropriate extension method in the view. But you can add the identifier yourself. This gives you more flexibility. (For example, if you have links that are not generated using @ Html.ActionLink .. etc.)

+1
source

The only way to achieve this is to add the session identifier to the URL that should be used for cookieless sessions. Unfortunately, you seem to have ruled out this possibility due to the ugly URLs it produces.

0
source

Source: https://habr.com/ru/post/1400121/


All Articles