Access IpublishedContent on Background task.
n
Anyone here have tried accessing page url inside the background task ? I tried this code but no luck . Anyone can help me what approach should I need to do here ? Thanks in advance > public IPublishedContent GetPage(int id) > { > using (var cref = _umbracoContextFactory.EnsureUmbracoContext()) > { > var cache = cref.UmbracoContext.Content; > return cache.GetById(id); > } > }
s
Is the page vary by culture? Then you need to set the variation context accessor to the right culture
m
Looks like the approach that I use most of the time, do you get any errors? Or just nothing back from the cache?
15 Views