Episerver Marketing Testing does not support custom cookie names

Found in

EPiServer.Marketing.Testing 2.5.5

Fixed in

EPiServer.Marketing.Testing 2.5.6

Created

Feb 12, 2019

Updated

Feb 26, 2019

State

Closed, Fixed and tested


Description

From partner developer

We have installed the Episerver Marketing Testing plugin v. 2.5.5 but we can’t see the thumbnails on the A/B test page.

Instead we get an 500 error:

https://local.xxx.se/EPiServer/EPiServer.Marketing.Testing/Stores/ThumbnailStore/$EPiServer$CMS$Content$,,396_228354$?epieditmode=False&dojo.preventCache=1549871135704
 
 
 
[NullReferenceException: Objektreferensen har inte angetts till en instans av ett objekt.]
 
   EPiServer.Marketing.Testing.Web.Repositories.ThumbnailRepository.GetContextThumbData() +234
 
   EPiServer.Marketing.Testing.Web.Repositories.ThumbnailRepository.GetCaptureString(String id) +72
 
   EPiServer.Marketing.Testing.Web.Controllers.ThumbnailStore.Get(String id) +24
 
   lambda_method(Closure , ControllerBase , Object[] ) +138
 
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +34
 
   System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +38
 
   System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +76
 
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +41
 
   System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0() +71
 
   System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
 
   System.Web.Mvc.Async.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +387
 
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
 
   System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__3() +50
 
   System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult) +188
 
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
 
  EPiServer.Shell.Services.Rest.RestControllerBase.EndExecute(IAsyncResult asyncResult) +60
 
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
 
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
 
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128

public ContextThumbData GetContextThumbData()
{
    KeyValuePair<string, string> keyValuePair = (contextHelper.GetCurrentContext().Request.Cookies[".AspNet.ApplicationCookie"] != null) ? new KeyValuePair<string, string>(".AspNet.ApplicationCookie", contextHelper.GetCurrentContext().Request.Cookies[".AspNet.ApplicationCookie"].Value) : new KeyValuePair<string, string>(".EPiServerLogin", contextHelper.GetCurrentContext().Request.Cookies[".EPiServerLogin"].Value);
    return new ContextThumbData
    {
        pagePrefix = contextHelper.GetCurrentContext().Request.Url.GetLeftPart(UriPartial.Authority),
        host = contextHelper.GetCurrentContext().Request.Url.Host,
        sessionCookie = contextHelper.GetCurrentContext().Request.Cookies[contextHelper.GetSessionCookieName()].Value,
        authCookie = keyValuePair.Key + "|" + keyValuePair.Value
    };
}

The problem is that we don’t use the name “.EPiServerLogin” as our cookie name. We use “.EPiServerLoginLocal” for our dev environment and in our production environment we use ADFS. How can we make generating thumbnails work in our different environments?