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 ?
This answer might be what you are looking for.
Might also make sense to ask whoever wrote this what he means by that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With