I have followed the documentation of Kentico 12 MVC to use a page builder in my project, but when I go to use in the page tab the preview of my view, the Kentico give me an error. Server Error in '/' Application.
The resource cannot be found.
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: /webform/teacherI create the controller: public class WebFormController : Controller
{
// GET: WebForm
public ActionResult Teacher()
{
// Retrieves the page from the Kentico database
TreeNode page = DocumentHelper.GetDocuments()
.Path(@/WebForm/Teacher@)
.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();
}
}
and the view too:
@{
Layout = @~/Views/Shared/_Layout.cshtml@;
}
@!DOCTYPE html@
@html@
@head@
@meta name=@viewport@ content=@width=device-width@ /@
@Html.Kentico().PageBuilderStyles()
@title@@/title@
@/head@
@body@
@div class=@home@@
@div class=@home__dark-indigo-container@@
@div class=@home__dark-indigo-container-wrapper@ style=@margin-left:40%;@@
@Html.Kentico().EditableArea(@area1@)
@/div@
@/div@
@/div@
@Html.Kentico().PageBuilderScripts()
@/body@
@/html@
Didn't work. What is happening wrong ?
↧