I read a comment from the answer to Session Variables in ASP.NET MVC . It is recommended to use HttpSessionStateWrapper and HttpSessionStateBase as opposed to using the session directly as follows: Session["MyValue"] :
If ASP MVC is used, then it is preferable not to use the actual Session Object from HttpContext.Current.Session, but to use the new HttpSessionStateWrapper and HttpSessionStateBase from System.Web.Abstractions.dll then use Factory or DI to get the Session.
Can someone provide an MVC example of using these two above classes to initialize, extract, and set session variables?
asp.net-mvc-3 asp.net-mvc-4
NoobDeveloper
source share