Wednesday, November 23, 2011

How To Create Session-less Controller in MVC3

How to manage the controller’s session state?

Simply we can decorate the controller class with “SessionState” attribute. [SessionState()] attribute accepts SessionStateBehaviour enumeration.

SessionStateBehaviour enumeration has the following constants.

SessionStateBehavior.Default - ASP.NET default logic is used to determine the session state behavior for the request.
SessionStateBehavior.Required – Full read-write session state behavior is enabled for the request.
SessionStateBehavior.ReadOnly – Read only session state is enabled for the request.
SessionStateBehavior.Disabled – Session state is not enabled for processing the request.

No comments:

Post a Comment