如何prevent多个浏览器窗口在asp.net共享相同的会话 [英] How to prevent multiple browser windows from sharing the same session in asp.net

查看:151
本文介绍了如何prevent多个浏览器窗口在asp.net共享相同的会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ASP.net应用程序,它基本上是一个物理检查过程数据输入画面。用户希望能够有多个浏览器窗口打开并从多个检查同时输入数据。起初我使用基于cookie的会议,显然这炸毁了。

I have ASP.net application that is basically a data entry screen for a physical inspection process. The users want to be able to have multiple browser windows open and enter data from multiple inspections concurrently. At first I was using cookie based sessions, and obviously this blew up.

我转向使用cookie的会话,它存储在URL中的会话,并在测试这似乎解决问题。每个浏览器窗口/标签有不同的会话ID和一个输入的数据并不会破坏在对方输入的数据。

I switched to using cookie-less sessions, which stores the session in the URL and in testing this seemed to resolve the problem. Each browser window/tab had a different session ID, and data entered in one did not clobber data entered in the other.

不过我的用户是在摔东西更有效的比我预期的,似乎他们仍然管理有时让浏览器之间的同一个会话。我认为他们在复制/为了打开应用程序从一个标签的粘贴地址到其他,但我一直无法核实这还没有(他们在其他位置,所以我不能轻易问他们)。

However my users are more efficient at breaking things than I expected and it seems that they're still managing to get the same session between browsers sometimes. I think that they're copying/pasting the address from one tab to the other in order to open the application, but I haven't been able to verify this yet (they're at another location so I can't easily ask them).

除了告诉他们不要复制和粘贴,或说服他们只能输入一次,哪能prevent发生这种情况呢?

Other than telling them don't copy and paste, or convince them to only enter one at a time, how can I prevent this situation from occurring?

推荐答案

我不确定你为什么要限制一个会话只处理一个检验过程,然后强制多个会话,以便用户在多个检查同时工作。这感觉就像一个隔离颇为尴尬的风格。

I am unsure why you wish to restrict a session to handle only one inspection process, and then force multiple sessions in order for users to work simultaneously on multiple inspections. That feels like a rather awkward style of isolation.

的网络应用程序(和页)应该能够为单个用户会话中处理多个检验过程

The web application (and pages) ought to be able to handle multiple inspection processes within a single user session.

这是会话变量被关押的任何数据不应该被暴露清楚奇异处理。他们应该被存储在<青霉>集合的该容易识别哪个组数据属于哪个检验过程。 <青霉>每个的页面提交回Web服务器应该携带它涉及到哪些检查过程中,以使正确的会话集可以匹配并拉使用的标识符

Whatever data that is being held in Session variables should not be plainly exposed for singular handling. They ought to be stored in collections that readily identify which set of data belongs to which inspection process. Every page submission back to the web server ought to carry an identifier which inspection process it pertains to, so that the correct session set can be matched and pulled for use.

伪code概念

var inspectionID = this.inspectionLabel.Text;
var inspectionSets = (Hashtable)Session["inspections"];
var inspection = (Inspection)inspectionSets[inspectionID];

这篇关于如何prevent多个浏览器窗口在asp.net共享相同的会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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