The following sections have been defined but have not been rendered for the layout page “~/views/shared/_layout.cshtml”: “footscript”

The error contents are as follows:

Method 1:

1. In the _Layout.cshtml layout body, add section, Scripts.Render and RenderSection tag sample code as follows:
<body class=”bodyBg font_fm”>
    @RenderSection(“scripts”, required: false)
2. In the content view to be used, use the section tag to put everything in the form in the section, you can
Method 2:

When searching on the Internet, there will be a lot of the first method, but I used it in my code but it was of no use.

After searching for a long time, I found the second one. Before using the second one, delete the first one, otherwise an error “Reuse RenderBody method” will be reported.

But the first one may be solved if some people use it, just because of the code.

Similar Posts: