ASP.NET应用程序多个选项卡/多个Windows [英] ASP.NET Application Multiple Tabs / Multiple Windows

查看:81
本文介绍了ASP.NET应用程序多个选项卡/多个Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当多个选项卡打开/多个Windows打开时,它会覆盖会话变量。这会弄乱结果。如何避免这种情况。

解决方案

会话存储在服务器上,但它由驻留在用户计算机上的cookie识别。这意味着用户为特定浏览器打开的任何窗口或标签都将共享同一会话。



诀窍是使用其他方式存储数据。其他一些选择是视图状态,控制状态,隐藏字段,数据库,查询搅拌,静态变量和cookie。如果您有一堆数据应始终驻留在服务器上,您可以选择混合方法。例如,您可以在隐藏的表单字段中存储唯一的ID,然后使用该ID在服务器端查找数据(即使在会话中)。



我建议您阅读有关 ASP.NET状态管理的更多信息。

When Multiple Tabs Opened / Multiple Windows Opened it''s overriding Session variables. that''s messing up the results. how to avoid this situation.

解决方案

Session is stored on the server, but it is identified by a cookie that resides on the user''s computer. That means any windows or tabs the user has open for a specific browser will all share the same session.

The trick is to use other means of storing the data. Some other choices are view state, control state, hidden fields, databases, query stirngs, static variables, and cookies. If you have a bunch of data that should reside on the server at all times, you might choose a hybrid approach. For example, you could store a unique ID in a hidden form field, then use that ID to look up the data on the server side (even in session).

I recommend you read more about ASP.NET State Management.


这篇关于ASP.NET应用程序多个选项卡/多个Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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