Asp.net 中会话的替代方案? [英] Alternative of Session in Asp.net?

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

问题描述

我们在我们的应用程序中使用 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[] 集合中设置的变量将丢失.在哪里至于会话变量,信息对多个请求有效这是用户特定的.会话变量仅在以下任一时间到期会话超时或明确清除值.

Items collections of HttpContext is and IDictionary key-value collections and that are shared across a single HTTPRequest. Yes, HttpContext.Current.Items valid for a single HTTPRequest. Once after processing, server information is sent back to the browser, the variables that were set in the Items[] collection will lost. Where as for Session Variable, information valid for multiple request as this is user specific. The session variable only expires either on Session Time Out or explicitly clear the values.

更多来自这些文章

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

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