Check the GetContentLink method implementation: Ensure that the implementation of GetContentLink method in the HttpContext extension is correct and compatible with CMS 12. It's possible that there might be changes in the CMS 12 framework that require modifications to this method.
Hi Deepa,
As I understand, The system is not able to return you content because it can't route the request to a piece of content https://world.optimizely.com/CsClassLibraries/cms/EPiServer.Web.Routing.HttpContextExtensions?version=12.
There for is there any customization around routing in your solution that is possibly causing an issue?
Paul
Hello,
There is no customization around routing in our solution, it's fetching contentlink properly for almost all pages. But only for some pages it's returning null on that highlighted line.
Thanks,
Deepa
Hello,
In below method OnResultExecuting(), highlighted line for currentContentLink is returned null for some pages (even though page just loads fine, but there is error in local environment for currentContentLink null value) in CMS 12 migrated project but it works fine in CMS 11 project.
Can anyone help us with this? What might be causing this strange behaviour?
public void OnResultExecuting(ResultExecutingContext filterContext)
{
if (filterContext == null)
{
throw new ArgumentNullException(nameof(filterContext));
}
var controller = filterContext.Controller as Controller;
var viewModel = controller?.ViewData.Model;
if (viewModel is IPageViewModel<SitePageData> model)
{
var currentContentLink = filterContext.HttpContext.GetContentLink();
var layoutModel = model.Layout ?? contextFactory.CreateLayoutModel(currentContentLink, filterContext.HttpContext);
if (filterContext.Controller is IModifyLayout layoutController)
{
layoutController.ModifyLayout(layoutModel);
}
model.Layout = layoutModel;
if (model.Section == null)
{
model.Section = contextFactory.GetSection(currentContentLink);
}
}
}
Thank you,
Deepa