asp.net中的会话冲突 [英] session conflict in asp.net

查看:71
本文介绍了asp.net中的会话冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用无炊具的表单身份验证.会话ID由系统生成并插入到查询字符串中.当两个用户第一次访问同一页面时,他们将获得具有正确会话ID的正确页面.但是在回发期间,User1获得了User2页面.

如何预防这个问题?

Hi,

I am using cookiless form authentication. the session ID''s are generated and inserted in the query string by the system. When two users access the same page very first time, they get the proper page with their correct session Ids. But during the post back User1 gets User2 page .

How to prevent this problem ? Has any body experienced this behaviour.

推荐答案

我已经看到从生产服务器使用Web园艺的测试到生产的这种行为(多个工作进程) ).对我来说,我在某些代码中发现了一个问题,其中开发人员使用静态变量来管理状态.使用网络园艺,您不能使用静态,因为您的下一个请求可能无法获得相同的过程.这意味着如果IIS分配了另一个工作进程,则下次发送请求时,所有静态变量分配都将丢失,或者您将选择其他用户.

我的建议是检查您的应用程序池配置,将辅助进程的数量设置为1,然后查看您是否仍然具有相同的行为.

如果该行为消失,则说明您未正确处理状态.尽管取决于您的编码方式,但您可能会看到两个用户都选择了最后一个登录者的状态.这两种方式都突出显示了状态管理问题.

如果行为仍然存在,请通知我,我会再考虑.
I''ve seen behaviour like this when moving from test to production where the production server was using web gardening (Multiple worker processes). For me I found an issue in some code where the developer was using static variables for managing state. With web gardening you can''t use statics as you may not get the same process for your next request. Which means the next time you send a request if IIS assigns a different worker process, any static variable assignments will be lost, or you''ll pick up another users.

My advice would be check your application pool configuration, set the number of worker processes to 1 and see if you still get the same behaviour.

If the behaviour disappears then you''re not handling state correctly. Although depending on how you''ve coded it you may see that both users pick up the state of the last person to log in. Either way it highlights a state management issue.

If the behaviour is still there then let me know and I''ll think again.


这篇关于asp.net中的会话冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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