Esteban
Esteban

Reputation: 3

Problems with HttpSessionState and HttpSessionStateBase

We've been migrating a system from web forms to MVC 4 and now we are having problems with the sessions.

As you should know, the MVC controllers use HttpSessionStateBase and the WebForms (in this case, the classes) use HttpSessionState. The constructor of the classes take as parameter a HttpSessionState variable and the problem is when we are instantiating those classes from the controller.

I already read about using the HttpSessionStateWrapper to wrap the the HttpSessionState in the classes to avoid that problem, but I can't find anything about how to use it, usually I only find examples like: HttpSessionStateWrapper Wrap = new HttpSessionStateWrapper("Parameter"); But I don't get if I need another library or something, since I'm only importing System.Web.SessionState and I can't use that class, even in the Microsoft page I only find that this is supposed to be in System.Web.HttpSessionStateWrapper, but I can't find anything like that.

I hope someone can help me with this.

Upvotes: 0

Views: 4835

Answers (1)

Sergei Rogovtcev
Sergei Rogovtcev

Reputation: 5832

It is other way around: you should not use HttpSessionState in MVC project, so you have to rewrite your "classes" using HttpSessionStateBase.

Upvotes: 2

Related Questions