简体   繁体   English

您可以检查Web应用程序是否已在另一个浏览器选项卡上运行吗?

[英]Can you check if a web application is already running on another browser tab?

I have a web application written in ASP.NEt/C# and javascript. 我有一个用ASP.NEt/C#和javascript编写的Web应用程序。 It uses session variables. 它使用会话变量。

When I open the application, is there a way to check if the application is running in another tab? 当我打开应用程序时,是否可以检查应用程序是否在另一个选项卡中运行?

Or do you have any ideas on making session variables unique for each tab? 还是您对将每个标签的会话变量都设为唯一有什么想法?

Any help would be great! 任何帮助将是巨大的!

Thanks 谢谢

Kev. 凯夫

First understand sessions. 首先了解会议。 The session is a file which lives on the server and holds some data. 会话是一个文件,驻留在服务器上并保存一些数据。 When the user gets a session they are really getting a cookie with some key to find which session is theirs. 当用户获得会话时,他们实际上是在获取带有某些密钥的cookie,以查找属于他们的会话。

Because of this, between different tabs in the same browser the cookie will be the same so it will access the same session on the server in both tabs. 因此,在同一浏览器中的不同选项卡之间,cookie相同,因此它将在两个选项卡中访问服务器上的同一会话。 You can make them unique by when you start the session giving a random ID but this (to my knowledge) will simply overwrite the previous session's value... 您可以通过在启动会话时提供一个随机ID来使其唯一,但这(据我所知)只会覆盖前一个会话的值...

You can use Session.IsNewSession() method to check For the Particular Session is a New one. 您可以使用Session.IsNewSession()方法检查“特定会话是新会话”。 Normally in web browsers with Multi Tabs the session is same through out that window 通常,在具有“多选项卡”的Web浏览器中,整个窗口的会话都是相同的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Web 浏览器中运行 WPF 浏览器应用程序 - Running WPF browser application in Web Browser 检查COM +应用程序是否已在运行? - Check if COM+ application is already running? 检测应用程序的另一个实例是否已在运行 - Detecting if another instance of the application is already running 使用ac#应用程序刷新浏览器中的选项卡(如果已打开) - refresh Tab in Browser if already open, using a c# application 您可以从网页向已经运行的单击一次应用程序发送参数吗? - Can you send arguments to an already running click once application from a webpage? 在 Web 浏览器中运行 WinForms 应用程序 - Running a WinForms Application Inside Web Browser 如何从客户端浏览器中运行的Angular Web应用程序发送邮件? - How can I send mail from an Angular web application running in a client's browser? TweetSharp:如何检查您的申请是否已被授权? - TweetSharp: How to check if you're application is already authorized? 如何控制Web浏览器应用程序中的打开的标签页? - How control opened tab in my web browser application? 检查从其他应用程序启动的DLL是否已打开 - Check if dll launched from another application is already open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM