Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

CookiePersonalizationEvaluator in episerver CMS 12



We upgraded CMS 11 to 12 using upgrade assistant and fixed package and other errors related to .Net core. Now when we run application we are facing this error in CookiePersonalizationEvaluator:

public class CookiePersonalizationEvaluator : IPersonalizationEvaluator
        public const string PersonalizeCookieKey = "Personalize";
        private readonly ServiceAccessor<HttpRequest> _requestAccessor;
        public CookiePersonalizationEvaluator(ServiceAccessor<HttpRequest> requestAccessor)
            _requestAccessor = requestAccessor;
      public bool Personalize() => _requestAccessor()?.Cookies[PersonalizeCookieKey] != null;


"Unable to resolve service for type 'EPiServer.ServiceLocation.ServiceAccessor`1[Microsoft.AspNetCore.Http.HttpRequest]' while attempting to activate '..Business.Personalisation.CookiePersonalizationEvaluator' "

As per the document it says to use HttpRequestBase but in .net core it doesn't support it.

Please help with this issue?

Edited, Jul 19, 2022 6:23

I believe you now need to use Microsoft.AspNetCore.Http.HttpContext

Please see more info here : 

Jul 20, 2022 9:15
* 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.