Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am new to C# but even newer to Umbraco. Sadly, I have hit a bit of a wall and can't work out why I receive the following error: The file "~/Views/Master.cshtml" cannot be requested directly because it calls the "RenderBody" method. I understand what it is saying (I think). You can't directly reference RenderBody() within a Template, RenderBody() and its content is merged in with the Template as and when it is requested. This article (on this site), and this one (on S.O) taught me that.
The file "~/Views/Master.cshtml" cannot be requested directly because it calls the "RenderBody" method.
This is my tree structure
'Master' is my 'base'' layout page with my HTML, Styles.Render, Scripts.Render etc which will form my main page Template. 'Standard Page' was created to point at that Layout page, and to place its content inside the RenderBody() called within 'Master'. My 'PageBase' Document Type for now just contains a text field with one input for 'Meta Description' which will show across all pages.
I did wonder whether I had set my Permissions and Templates right for my Document Types, but it does look like it.
Layout = null;
<html class="app no-js" lang="en" dir="ltr">
<meta name="description" content="@Model.Content.MetaDescription" />
@RenderSection("scripts", required: false)
My very simple 'Standard Page' Template looks like this:
Layout = "Master.cshtml";
When I run the application this is my error:
I am so grateful for some guidance - thank you! :-)
Hello David and welcome to Our :-)
If I understand things correctly then I think the issue is that you have selected the "Master" template on your "Standard page" document type.
You should select the "Standard page" template for it instead and then things should be working.
I hope this makes sense and that I understood your issue correctly.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted