关于asp.net MVC 3:如何使用新的HttpSessionStateWrapper和HttpSessionStateBase?

How do I use new HttpSessionStateWrapper & HttpSessionStateBase?

我从ASP.NET MVC中的Session变量的答案中读取了注释。 建议使用HttpSessionStateWrapperHttpSessionStateBase,而不是直接使用会话,如下所示: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.

有人可以提供一个使用上述两个类初始化,检索和设置会话变量的MVC示例吗?


这个答案可能就是您想要的。

也许问问谁写了这个,他的意思是什么。