且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在与不同用户登录时避免会话值交换

更新时间:2023-12-04 19:18:10

只要正确跟踪会话,会话就不应重叠。如果发生这种情况,则有两种可能性之一:

1.名称未存储到会话中,而是存储为静态变量(或在应用程序状态,或缓存等) )。将名称移动到HttpContext.Current.Session [userName]变量应该可以解决问题。



2.可能在应用程序中修改了会话处理一个容易发生碰撞的系统。检查global.asax并确保会话逻辑没有被修改。


首先检查你的系统中的代码alyas session的bcose在每次登录时都是唯一的,所以没有任何案例交换值,

会话规则是:



会话是针对孔应用的conman,但对每个用户都不同。

Dear Friends,

I am using VS 2008,C#,asp.net,dev express 11
I have a web application.which has a session which contain the logined user's name.
Which is stored when login to the application in login page.

When users are logined concurrently, the label ( shows the username) is getting swapped.
The label is assigned the session value of logined user name.

How to avoid session overlap?
That means The label should show the name of the logined user when logined with different user names concurrently

Thanks in advance
george

Sessions shouldn't overlap as long as they are being tracked appropriately. If this is occurring, there is one of 2 likelihoods:
1. The name is not being stored to the session, but is being stored as a static variable (or in the application state, or cached etc). Moving the name to the HttpContext.Current.Session["userName"] variable should resolve the issue.

2. It's possible that session handling has been modified in the application to a system that is collision-prone. Check the global.asax and make sure that session logic hasn't been modified.


First check your code in your system bcose of alyas session are unique in every login so there is not any case to swap the values,
The Rule for session is:

Session is conman for hole application but different for every users.