问题描述
我们在我们的应用程序中使用 Asp.net Session 进行状态管理.默认情况下,正在使用进程内模式.但是现在,由于性能问题,我们的客户要求我们从应用程序中删除 Session,因此我们必须寻找替代方案.
We are using Asp.net Session in our application for state management. By default, In-proc mode is being used. But now, we have to look for an alternative as we have been asked to remove Session from our application by our client due to performance issue.
其中一种方法是将客户端的所有内容保留在回发的隐藏字段中.这肯定不是一个好方法.
One of the way is to keep everything at Client side say in hidden field on Postback. It's not a good approach for sure.
还有其他方法吗?我确定会有替代方案.
Is there any other way of doing it? Im sure there would be an alternative.
PS:请不要推荐查询字符串.
PS: Please don't suggest Querystring.
谢谢,
顶
推荐答案
类似于 HttpContext.Current.Items
但寿命较短的东西
Something close to that is HttpContext.Current.Items
but has a shorter life span
HttpContext is 和 IDictionary key-value 的Items集合集合,并在单个 HTTPRequest 中共享.是的,HttpContext.Current.Items 对单个 HTTPRequest 有效.一次处理后,将服务器信息发送回浏览器,在 Items[] 集合中设置的变量将丢失.在哪里至于会话变量,信息对多个请求有效这是用户特定的.会话变量仅在以下任一时间到期会话超时或明确清除值.
更多来自这些文章
这篇关于Asp.net 中会话的替代方案?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!