Hey everyone,
I'm working on setting up the page builder in the admin interface of Kentico 12 MVC. I have been following the tutorial and have been getting stuck when actually looking at the preview page/page builder. I'm having an issue under the Page tab. The Page tab isn't loading the "editable page" or anything at all for that.
It is showing a 404 error and saying Server Error in '/' Application.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /cmsctx/pv/administrator/culture/en-US/wg/218d9733-0027-46b9-afaa-71204ba2b677/readonly/0/ea/1/h/25bb70bd3859dc13d1fa1405e7994a1917ac11d6be830224066a867c1c67ed7a/-/
When looking at the Event log, it shows this error
Message: This preview URL has already expired. Please contact a responsible person to provide you with a valid preview URL.
The URL Pattern I set for this page type is '/' and I've tried /Home. This is also just testing the home/root page.
I've added the page builder code in my Global.asax.cs
// Gets the ApplicationBuilder instance
// Allows you to enable and configure Kentico MVC features
ApplicationBuilder builder = ApplicationBuilder.Current;
// Enables the preview feature
builder.UsePreview();
// Enables the page builder feature
builder.UsePageBuilder();
I've also added the code snippit to search for the home page in the home controller.
TreeNode page = DocumentHelper.GetDocuments()
.Path("/Home")
.OnCurrentSite()
.TopN(1)
.FirstOrDefault();
// Returns a 404 error when the retrieving is unsuccessful
if (page == null)
{
return HttpNotFound();
}
// Initializes the page builder with the DocumentID of the page
HttpContext.Kentico().PageBuilder().Initialize(page.DocumentID);
return View();
Lastly, in the view I added the PageBuilderStyles and PageBuilderScripts()
Thanks for any help!