How to enable session on just a page level not on all the website?
I am developing a website to extend community server, and i found that community server disabled the session in the web.co开发者_开发技巧nfig <sessionState mode="Off" />
.
I don't know that you can enable session state just for a single page - possible, but unlikely.
Instead, you could look to use either the ASP.NET Cache, which is similar but does not isolate data between sessions (you'd have to do that yourself). Or, you could look to create a static data structure somewhere in your application that manages per-session state. Lastly, you may be able to just make your objects serializable and store them in ViewState (if they aren't to large). ViewState can be configured at the individual page (or even Control) level.
You should try to be consistent with the approach your organization has chosen regarding state management. There may be a reason that server-side state is being avoided (perhaps for something like load balancing). Without understanding the reasoning behind this decision, you may introduce unexpected problems.
精彩评论