SaaS CMS has officially launched! Learn more now.

EPiServer 6 page version compare function exception


Hi, everyone.

I'm experiencing problem while trying to compare publish page versions in EPiServer CMS 6.

Exception Details: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration.


Exception is thrown on line that tries to access Session.

I've installed an empty cms 6 website using EPiServer Deployment manager and the same situation. Call like following <%=this.Session["someSessionKey"]%> - throws exception as above.

It proves that exception occures not because my project configuration.


After some "reflectoring" episerver code found following:

EPiServer.UI.Edit.PageCompare.Core.PageComparerProviderBase, EPiServer.UI, Version=6.0.530.0

method: private static string GetHtmlByDummyRequest(string pageUrl)

    string str;
    DummyWorkerRequest dummyRequest = GetDummyRequest(pageUrl);
    HttpContext current = HttpContext.Current;
        HttpContext.Current = new HttpContext(dummyRequest);
        HttpContext.Current.User = current.User;
        IHttpHandler handler = (IHttpHandler) BuildManager.CreateInstanceFromVirtualPath(dummyRequest.GetFilePath(), typeof(Page));
        HttpContext.Current.Handler = handler;
        typeof(HttpContext).InvokeMember("_ProfileDelayLoad", BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance, null, HttpContext.Current, new object[] { true });

HttpContext.Current.Response.Flush(); str = dummyRequest.OutputWriter.ToString(); } finally { HttpContext.Current = current; } return str; }

During that kind of call Context is not fully initialized and exception happens.

Does anyone know how to handle this situation?

Thanks in advance,

Sep 22, 2010 14:42

Call to the page is made as HttpContext.Current.Handler.ProcessRequest(HttpContext.Current); So it is not a full page get reguest.

Sep 22, 2010 14:51

Looks like the Bug#54423 Compare page versions crashes when page uses session object

Sep 22, 2010 14:58

Hi I am having the same issue. Do you know if there is any update to this? or perhaps you can point me towards where I could find out?

Thank you


Jan 10, 2011 19:39

This is odd, I can't seem to find the bug in the bug list. It is discussed in this thread too:

I think I got the bug ID from the response to my original bug report.

Perhaps someone at EPiServer can check what happened to the bug?

Jan 11, 2011 6:58


I checked the bug and it was closed as a duplicate of bug #41873 which should be fixed in the CMS 6 R2 beta release.

Linus Ekström
EPiServer Development Team

Jan 11, 2011 8:12

Is there a hotfix for this bug for CMS 6 as we are not in a position to upgrade to R2 at this time?

Mar 15, 2012 15:42
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.