EPiServer 7 patch 2, MVC and session state

When my colleague Niklas Melinder applied patch 2 for EPiServer 7 he ran into trouble when the site was deployed to our acceptance server. The site started to throw “System.InvalidOperationException: The SessionStateTempDataProvider class requires session state to be enabled.”. Since our acceptance environment runs with sessions state switched off it was pretty clear what caused the error but why it happened was not.

After some reflection the following in PropertyExtensions seemed to be the culprit


Using TempData requires session state if the value is not used in the same request (see the answer to this q on SO). This code is used for the PropertyFor extensions methods so it seems webform pages are not affected by this but we haven’t really looked into that.

  • http://twitter.com/johankronberg Johan Kronberg

    Self-Optimizing Block 1.0 also requires enabled SessionState :/ Haven’t found any EPi controlled places requiring it using Web Forms on Patch 2 and 7.1 UI. That’s the way it should be.

    • http://www.popkram.com Stefan Forsberg

      Apparently this is not intended and it will be fixed in a future patch.

  • http://www.facebook.com/javafun Vincent Yang

    why do require the session state switched off on your acceptance server? it will cause more issues rather than just this one,