使用ASP.NET的WebForms,可以设置会话状态模式在页面指令:
With ASP.NET WebForms it is possible to set the session state mode in the page directive:
<%@ Page EnableSessionState="true|false|ReadOnly" %>在ASP.NET MVC(例如每个控制器或每个动作)是相同的配置也是可能的,如果是这样,怎么样?
Is the same configuration also possible in ASP.NET MVC (e.g. per controller or per action) and if so, how?
(换句话说:我可以禁用或设置为只读,每控制器/动作我认为有会话状态会话状态的读/写会导致一些开销,因此,如果会话状态可以把它可能是有益的关闭,如果不是必需的。)
(In other words: can I disable or set to read-only session state per controllers/actions? I assume having the session state read/write will result in some overhead, so it might be useful if session state could be turned off if not required.)
推荐答案这似乎与ASP.NET MVC 3将有可能拥有会话少控制器,例如看ScottGu's博客文章或this基思·达尔比发布。
It seems that with ASP.NET MVC 3 it will be possible to have session-less controllers, e.g. see ScottGu's blog post or this post by Keith Dahlby.
更多推荐
Page.EnableSessionState相当于在ASP.NET MVC
发布评论