Pre-emptive screenshot generation functionality does not work when requireSSL="true"

  • Description

    When the value of the requireSSL attribute in the Web.config file is set to "true":

    <authentication mode="Forms">
     <forms loginUrl="member_login.aspx" cookieless="UseCookies" requireSSL="true" path="/MyApplication" />
    </authentication>
    the pre-emptive screenshot generation does not work properly and can cause various issues. For example, the package generation can fail, with the following error in the log:
    Message: The application is configured to issue secure cookies. These cookies require the browser to issue the request over SSL (https protocol). However, the current request is not over SSL.
     Source: System.Web
       at System.Web.Security.FormsAuthentication.SetAuthCookie(String userName, Boolean createPersistentCookie, String strCookiePath)
       at Sitecore.Security.Authentication.FormsAuthenticationProvider.Login(User user)
       at Sitecore.ContentTesting.Events.GenerateScreenshot.PopulateCookiesForNewSession(List`1 cookies)
       at Sitecore.ContentTesting.Events.GenerateScreenshot.StartRun(Item item, ItemChanges changes)
       at Sitecore.ContentTesting.Events.GenerateScreenshot.OnItemSaved(Object sender, EventArgs args)
       at Sitecore.Events.Event.EventSubscribers.RaiseEvent(String eventName, Object[] parameters, EventResult result)
       at Sitecore.Events.Event.RaiseEvent(String eventName, Object[] parameters)
       at Sitecore.Events.Event.RaiseItemSaved(Object sender, ItemSavedEventArgs args)
       at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
       at Sitecore.Data.Engines.EngineCommand`2.RaiseEvent[TArgs](EventHandler`1 handlers, Func`2 argsCreator)
       at Sitecore.Data.Engines.EngineCommand`2.Execute()
       at Sitecore.Data.Engines.DataEngine.SaveItem(Item item)
       at Sitecore.Data.Managers.ItemProvider.SaveItem(Item item)
       at Sitecore.Data.Managers.PipelineBasedItemProvider.ExecuteAndReturnResult[TArgs,TResult](String pipelineName, String pipelineDomain,Func`1pipelineArgsCreator, Func`1 fallbackResult)
       at Sitecore.Data.Managers.PipelineBasedItemProvider.SaveItem(Item item)
       at Sitecore.Data.Items.ItemEditing.AcceptChanges(Boolean updateStatistics, Boolean silent)
       at Sitecore.Install.Items.ItemInstaller.VersionInstaller.InstallVersion(Item version)
       at Sitecore.Install.Items.ItemInstaller.VersionInstaller.PasteVersion(XmlNode versionXml, Item target, VersionInstallMode mode, IProcessingContext context, Boolean removeOtherVersions)
       at Sitecore.Install.Items.ItemInstaller.InstallEntry(PackageEntry entry)
  • To resolve the issue, disable the pre-emptive screenshot generation.

    Sitecore XP 8.0 Initial Release – 8.1 Update-2:

    Open the \App_Config\Include\Content Testing\Sitecore.ContentTesting.config file and comment out the following lines:

    <event name="item:saved">
      <handler type="Sitecore.ContentTesting.Events.GenerateScreenshot, Sitecore.ContentTesting" method="OnItemSaved">
        <excludeFields hint="list:ExcludeFieldFromComparison">
          <created>__created</created>
          <createdby>__created by</createdby>
          <updated>__updated</updated>
          <updatedby>__updated by</updatedby>
          <revision>__revision</revision>
          <sortorder>__sortorder</sortorder>
          <validfrom>__valid from</validfrom>
          <workflow>__workflow</workflow>
          <workflowstate>__workflow state</workflowstate>
          <lock>__lock</lock>
          <pageleveltestsetdefinition>__Page Level Test Set Definition</pageleveltestsetdefinition>
        </excludeFields>
      </handler>
    </event>
    <event name="item:saved:remote">   <handler type="Sitecore.ContentTesting.Events.GenerateScreenshot, Sitecore.ContentTesting" method="OnRemoteItemSaved">     <excludeFields hint="list:ExcludeFieldFromComparison">       <created>__created</created>       <createdby>__created by</createdby>       <updated>__updated</updated>       <updatedby>__updated by</updatedby>       <revision>__revision</revision>       <sortorder>__sortorder</sortorder>       <validfrom>__valid from</validfrom>       <workflow>__workflow</workflow>       <workflowstate>__workflow state</workflowstate>       <lock>__lock</lock>       <pageleveltestsetdefinition>__Page Level Test Set Definition</pageleveltestsetdefinition>     </excludeFields>   </handler> </event>

    Sitecore XP 8.1 Update-3 and later:

    Disable the \App_Config\Include\Content Testing\Sitecore.ContentTesting.PreemptiveScreenshot.config file.

Applies to:

CMS 8.0+

September 26, 2017
September 26, 2017

Reference number:

443413, 82106

Keywords: 

  • Content Testing