AnswerBun.com

Prevent sitecore from creating the the sitename#lang cookie

Sitecore Asked by Manoj Sreekumar on December 20, 2021

2 Answers

As far as I know, {sitename}#lang cookie is set by the LanguageResolver processor.

There is a code

args.SitecoreContext.Language = lang;

And in the background, setter of the Language property of the context calls

  string cookieKey = site.GetCookieKey("lang");
  WebUtil.SetCookieValue(cookieKey, language.Name, expiryDate ?? DateTime.MinValue);

I haven't found any option to stop Sitecore from creating that cookie.

The only option would be to add a custom processor to httpRequestBegin processor after Sitecore.Pipelines.HttpRequest.LanguageResolver processor and in that processor remove the cookie from the response.

Answered by Marek Musielak on December 20, 2021

I'm not sure if it's the same processor but you might try the follow which removes the site cookie.

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestProcessed>
        <processor type="Sitecore.XA.Foundation.Multisite.Pipelines.HttpRequest.StoreSiteNameInCookie, Sitecore.XA.Foundation.Multisite">
          <patch:delete />
        </processor>
      </httpRequestProcessed>
    </pipelines>
  </sitecore>
</configuration>

Answered by Michael West on December 20, 2021

Add your own answers!

Related Questions

Show current date in yy/MM/dd format

0  Asked on November 20, 2021

 

Using Model in Scriban template

1  Asked on November 7, 2021

   

Using List in SXA rendering variant

1  Asked on November 4, 2021

 

How do I query GraphQL using SPE?

1  Asked on August 23, 2021 by bic

     

LowerCaseKeywordAnalyzer does not work

0  Asked on August 23, 2021 by vivek-venugopalan

   

Add a Buyer Role to a User programatically

0  Asked on August 23, 2021 by shrad

 

Ask a Question

Get help from others!

© 2023 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP