7

I read a comment from an answer to Session variables in ASP.NET MVC. It is recommending to use HttpSessionStateWrapper and HttpSessionStateBase as opposed to using session directly as follows: Session["MyValue"]:

If ASP MVC is being used then it is preferable to not use the actual Session object from HttpContext.Current.Session but to use the new HttpSessionStateWrapper & HttpSessionStateBase from System.Web.Abstractions.dll then use a Factory or DI to get the Session.

Can someone provide an MVC example of using these two aforementioned classes to initialize, retrieve, and set session variables ?

Toby Speight
  • 27,591
  • 48
  • 66
  • 103
NoobDeveloper
  • 1,877
  • 6
  • 30
  • 55
  • 1
    I happened to see this comment and reference to what the OP attempted to ask here - it is from a highly marked up comment on: HttpSessionStahttp://stackoverflow.com/questions/560084/session-variables-in-asp-net-mvc/560115#560115eWrapper – atconway Jan 30 '14 at 19:33
  • Check out [Darin's answer](http://stackoverflow.com/a/5448138/1123275) for a good example of how to use the 2 classes and explanation. – Scotty.NET Sep 17 '14 at 10:56

1 Answers1

2

This answer might be what you are looking for.

Might also make sense to ask whoever wrote this what he means by that.

Community
  • 1
  • 1
Dmitry Efimenko
  • 10,973
  • 7
  • 62
  • 79