Alternative of Session in Asp.net?

放肆的年华 提交于 2019-12-13 01:38:18

问题


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: Please don't suggest Querystring.

Thanks,

Sumit


回答1:


Something close to that is HttpContext.Current.Items but has a shorter life span

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.

More from these articles

  • When we can use HttpContext.Current.Items to stores data in ASP.NET


来源:https://stackoverflow.com/questions/12995622/alternative-of-session-in-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!