Due to GDPR we have implemented a Cookie Consent banner on our Sitecore solution. As part of this implementation, we have created a custom pipeline to remove the SC_ANALYTICS_GLOBAL_COOKIE
from the request if consent for statistical cookies has not been given.
This has created an issue on pages where content testing is being used. If the cookie is not present in the request, the user gets an ugly error page
The error from the log is this:
9580 14:43:35 ERROR Application error.
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.ContentTesting
at Sitecore.ContentTesting.Pipelines.EvaluateTestExposureBase`1.Process(TPipelineArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Sitecore.Mvc.Pipelines.PipelineService.RunPipeline[TArgs](String pipelineName, TArgs args)
at Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
We would expect the content test to fail gracefully and just be ignored for requests without the cookie, as we are required to remove the cookie without proper consent.
Did anyone else run into this problem, and have a possible solution?