Enable / disable session state per controller / action method

故事扮演 提交于 2019-11-27 08:38:55

This is included in MVC 2 Futures. See http://blogs.msdn.com/rickandy/archive/2009/12/17/session-less-mvc-controller.aspx for more info.

Will Dean

This is now moved from Futures into MVC3. There's a ControllerSessionState attribute (apparently will be named SessionState for the final release of MVC3), which can be applied to a controller, something like this:

[SessionState(SessionStateBehavior.Disabled)]
public class MyController : Controller
{
 ...

(But in the RC version, you must use ControllerSessionState

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