在ASP.NET MVC 3应用程序每个浏览器标签/窗口新建会话 [英] New session per browser tab/window in ASP.NET MVC 3 app

查看:75
本文介绍了在ASP.NET MVC 3应用程序每个浏览器标签/窗口新建会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要每个浏览器窗口/标签一个新的会话。我是知道的ASP.NET分配每个进程一个会话的事实。我也知道,浏览器共享应用程序的所有打开的标签/窗口之间的会话。但是,我需要拿出一个办法来创建一个新的标签/窗口,一个新的会话。

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.

无Cookie会话状态不是一个选项也。我已经看了看说。我期待,以保持URL的清洁。

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

我看着下面的解决方案。
1)<一个href=\"http://stackoverflow.com/questions/2840615/asp-net-session-multiple-browser-tabs-different-sessions\">asp.net - 会话 - 多个浏览器标签 - 不同的会话。此解决方案建议使用IsPostBack属性,这是不是在MVC可用。
2) https://sites.google.com/site/sarittechworld/track-client -Windows 。这个看起来很复杂,我不完全理解它发生的JavaScript魔术。我并不想摆在那,我不明白的解决方案。另外,我不完全了解的任何安全漏洞,这种解决方案可能产生。

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?

推荐答案

我已经创建了一个包的NuGet名为ASP.NET MVC对话会议。这里你可以找到更多信息: http://blog.micic.ch/net / ASP净MVC-对话会话

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

我昨天发布了第一个版本。看看演示code或下载演示解决方案,让我知道,如果有事情来改善。 :)

I released the first version yesterday. Have a look at the demo code or download the demo solution and let me know if there are things to improve. :)

编辑:默认情况下:在标识是通过URL当您使用在查看相应的扩展方法传递。但是你可以在你自己添加的标识符。它给你更多的flexiblity。 (例如,当你有没有通过@ Html.ActionLink ..等生成的链接。)

By default: The "identifier" is passed via URL when you use the appropriate extension method in the View. But you can add the identifier on your own. It gives you more flexiblity. (For example when you have links which are not generated via @Html.ActionLink.. etc.)

这篇关于在ASP.NET MVC 3应用程序每个浏览器标签/窗口新建会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆