Cannot be requested directly because it calls the "RenderBody" method.
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.
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.
Cannot be requested directly because it calls the "RenderBody" method.
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 referenceRenderBody()
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.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 theRenderBody()
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.
My very simple 'Standard Page' Template looks like this:
When I run the application this is my error:
I am so grateful for some guidance - thank you! :-)
-David
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.
/Jan
is working on a reply...