Monday 8 March 2021

Sitecore dictionary item not getting phrase value intermittent issue

While working with Sitecore dictionary items, there are scenarios where not getting phrase value for dictionary items. And this issue intermittent(occasional type) not always facing this issue.

After spending time to find root cause of this issue - found that it's because of Dictionary Caching Issue.

And to resolve issue, there are several ways - can choose as per your fit.



1. Solve this issue by doing Global Change - Reset Dictionary Cache at application level

Please put below line of code in your application startup file

Sitecore.Globalization.Translate.ResetCache(true)


2. Solve this issue by Manual Steps - Reset Dictionary Cache

  • Shut down your app pool
  • Remove dictionary.dat from webroot/temp/ folder
  • Start your app pool again

3. Solve this issue by inserting custom pipeline - On Publish event reset dictionary cache.

update below config in Sitecore.config directly or add as new patch config inside (~/App_config/Include)

<event name="publish:end">

<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">

<sites hint="list">

<site>website</site>

</sites>

</handler>

<handler type="CustomNamespacePath, Customdll" method="CustomMethodName"/>

</event>


<event name="publish:end:remote">

<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">

<sites hint="list">

<site>website</site>

</sites>

</handler>

<handler type="CustomNamespacePath, Customdll" method="CustomMethodName"/>

</event>


After above config change, write logic to reset dictionary cache in your custom class  which will mention in above config file.




Hope this will help, please share your thoughts - incase of any better approach/feedback.

Thursday 18 February 2021

How to view Sitecore content delivery showconfig.aspx

All Sitecore configuration get compiled and consolidate in showconfig.aspx file. And this config is the best way to verify default or custom configuration using

https://sc101.cm/sitecore/admin/showconfig.aspx

But recently we were facing configuration issue on CD server since there were no default way to verify showconfig.aspx on content delivery server.


Just to hack this and look showconfig.aspx for content delivery server please follow below steps:


1. Download config click here and save to your instance path wwwroot/sc101.cd

2. From Talend API Tester/Postman, put below input to get output(CD server showconfig.aspx as response) as below screenshot


sitecore-content-delivery-showconfig





Method Type: GET

URL: https://YourInstanceName/sitecorecontentdeliveryshowconfig.aspx

Header keys apikey: 464799ae52214c80b7fc81408f8efbe0




Now check your output. Hope this help.