#Access IpublishedContent on Background task.

1 messages · Page 1 of 1 (latest)

strong crypt
#

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);
}
}

chilly jetty
#

Is the page vary by culture? Then you need to set the variation context accessor to the right culture