Session less controller in MVC3

2019-09-19 07:36发布

问题:

I have heard about sessionles controller in MVC3.

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

 }

If I use the sessionless controllers, then how I can browse accross the pages in my application for a particuler user? What is the best practice?

回答1:

If you wish to have a concept of a single user browsing multiple pages, a standard Session-enabled controller is best practice.

Controllers with session state disabled provide an optimization for controllers that do not require session state.

By default the ASP.NET pipeline will not process requests belonging to the same session concurrently. It serialises them, i.e. it queues them in the order that they were received so that they are processed serially rather than in parallel.

http://tech-journals.com/jonow/2011/10/22/the-downsides-of-asp-net-session-state