多个Ie的相同会话ID [英] Same Session id for multiple Ie's

查看:108
本文介绍了多个Ie的相同会话ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的c#asp.net应用程序中,当用户登录时,我将所有用户详细信息存储在会话中.

但是我遇到了一种情况,用户信息正在交换(第一个用户正在获取第二个用户的详细信息).

在我的情况下,多个用户可以从同一系统登录.

我的观察是,即使打开了新的IE(不是选项卡),也将共享相同的会话ID.

In my c# asp.net application, when the user is logging in i am storing all the user details in session.

But i am running in to a situvation where useres information is getting swapped(First user is getting the details of second user).

In my scenario multiple users can log in from the same system.

My observation is even though if a new IE(not tab) is opened the same session id will be shared.

Any ideas?

推荐答案

主要浏览器(例如IE,FF和Google Chrome)都默认使用相同的Cookie集合,而不管是否打开重复的网站新标签页或新浏览器实例中的页面.

结果是默认情况下,两个不同的选项卡或同一浏览器的2个实例在服务器上看起来像是同一会话.

因为多个实例使用相同的cookie,所以服务器无法区分它们的请求,并且会将它们与相同的Session数据相关联,因为它们都具有相同的SessionID(假定基于cookie的SessionID).

通常,此行为没有任何问题,并且您必须针对该行为提供一个良好的业务案例,才能对周围的问题进行编码.

另一方面,您所要做的就是将一组用户/服务器交互视为一种会话内的会话",您可以通过在ViewState中存储随机GUID并在回发时对其进行检查来做到这一点
The major browsers (like IE, FF and Google Chrome) all default to using the same collection of cookies regardless of whether you are opening a duplicate web page in a new tab or a new browser instance.

The result is that 2 different tabs, or 2 instances of the same browser, by default, will look like the same session to the server.

Because the multiple instances use the same cookies, the server cannot tell requests from them apart, and will associate them with the same Session data, because they all have the same SessionID, assuming cookie-based SessionID.

Generally there is nothing wrong with this behaviour, and you would have to have a good business case against that behaviour to want to code a work around.

on the other hand, what you are after is to treat a group of user/server interactions as a kind of "session within a session", you may be able to do this by storing a random GUID in ViewState, and checking it on postback.




如果您将IE与其他实例一起使用,则将共享会话信息.如果您使用的是IE,FireFox,Chrome,则所有不同的浏览器都会保留不同的会话信息.

您还可以做一件事,将会话信息存储在数据库中,并使用唯一的ID(例如GUID)分隔每个实例.这可能对您有帮助,

谢谢
-Amit.
Hi,

if you are using IE with different instance , session information will be shared. if you are using IE, FireFox, Chrome then all different browser will keep different session information.

you can also do one thing, store session information in database and separate each instance with unique id (say GUID). this may help you,

thanks
-Amit.


这篇关于多个Ie的相同会话ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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