asp.net会话ID改变上回发? [英] asp.net sessionID changing on postbacks?

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

问题描述

我写存储在缓存中的对象的asp.net应用程序。当页面加载的第一次,它会检查对象的缓存,如果它的存在,它就会使用该对象。如果对象不存在,它将重新构建它并将其存储在缓存中。由于多个用户可以同时使用这个程序,我试图对象存储在缓存键作为的SessionID缓存。嗯,我注意到,当页面回的sessionID的变化,所以我将需要使用不同的唯一键。有什么建议么?我想使用登录的人的用户ID,但是这不是唯一的决定,因为你可以用相同的ID多次登录。

I am writing an asp.net app that stored an object in cache. When the page loads the first time, it checks the cache for the object, if it is there, it will use the object. if the object does not exist, it will re-build it and store it in cache. since multiple users can use this app at the same time, i was trying to store the object in cache with the cache key being the SessionID. Well, i noticed that when the page posts back, the sessionID changes, so I will need to use a different unique key. Any suggestions? I was thinking about using the userID of the person logged in, but that is not unique either, since you can login with the same id multiple times.

推荐答案

会话ID不应该改变上回发。它是利用asp.net做类似的事情。
你能提供的方案的更多信息?什么类型的数据,为什么/当你想缓存

The session id shouldn't be changing on postbacks. It is used by asp.net to do a similar thing. Can you provide more info on the scenario? what type of data, why/when are you trying to "cache"

更新1:关于其更改每个帖子后面,你有没有禁用Cookie吗?其中asp.net的版本,您使用的?

Update 1: Regarding it changing on each post back, have you disabled cookies? which version of asp.net are you using?

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

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