Try our conversational search powered by Generative AI!

IContentRepository - Work after clearing cache



Inspired by the this arcticle, I've created a setting page.

At first it worked perfectly but I noticed that at some point in time, the contentrepository return is null when I tryed to retreive the page:

public ActionResult GetSettings(DealerLocationRequestParameter parameter)
   var settings = _contentRepository.GetChildren(ContentReference.RootPage).FirstOrDefault();

If I switch my web browser in private mode (or clean the web browser cache manually), it works again.

How can I fix it ? What is in cache that created this issue ?


Edited, Jun 28, 2018 16:13

Hmm, If it works when opening up a new browser or clears the browser then it is not that call to content repository that returns null but rather some client side caching that gets stale. You could verify that by having a breakpoint in the above code.

Jun 29, 2018 5:17

That's it how I figured it out. The variable "settings" above, is null if I don't clear the cache. undecided

Jun 29, 2018 17:12

HI - I am having the same issue. Can you please advise?

Aug 08, 2019 18:38

Make sure you have created the settings page in every language you are using. Easy to forget. Alternatively, change the above code to always get settings page in master language. 

Aug 12, 2019 15:39
* 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.