getting exception "Object reference not set to an instance of an object." while getting current page from an interface as working in dancing goat sample project i have created an interface and declare a property as "LandingPage GetLandingPage(string pageAlias);" and create a parametric constructor and create object of interface in constructor parameter. while getting landingPage it says null reference exception, my pageAlias is not null,
public ActionResult Index(string pageAlias) { var landingPage = mRepository.GetLandingPage(pageAlias); if (landingPage == null) { return HttpNotFound(); } HttpContext.Kentico().PageBuilder().Initialize(landingPage.DocumentID); return View(); }
Do you have the correct routing for getting the pageAlias? Do you have the right pattern assign to the landing page type in CMS?
Please, sign in to be able to submit a new answer.