Page.EnableSessionState equivalent in ASP.NET MVC

前端 未结 2 787
梦谈多话
梦谈多话 2020-12-31 06:19

With ASP.NET WebForms it is possible to set the session state mode in the page directive:

<%@ Page EnableSessionState=\"true|false|ReadOnly\" %>


        
相关标签:
2条回答
  • 2020-12-31 06:43

    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.

    0 讨论(0)
  • 2020-12-31 06:59

    The ASP.NET MVC 3 equivalent to this appears to be the SessionState attribute, which you apply at the controller level - e.g.

    [SessionState(SessionStateBehavior.ReadOnly)]
    

    See http://msdn.microsoft.com/en-us/library/system.web.mvc.sessionstateattribute.aspx for more info.

    Thanks to https://stackoverflow.com/a/4235006/372926

    0 讨论(0)
提交回复
热议问题