title: Section has been defined but not rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head"
body: <p>I created a new MVC4 internet application. I'm just following the book ASP.NET MVC4 in Action. The chapter is Ajax is ASP.NET in MVC. 
  the view for index goes like this</p>
  
  <pre><code>@section head{
      &lt;script type ="text/javascript"
  
              src="@Url.Content("~/Scripts/AjaxDemo.js")"&gt;&lt;/script&gt;
  }
  
  @Html.ActionLink("Show the privacy policy", "PrivacyPolicy", null, new{id="privacyLink"})
  
  &lt;div id="privacy"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>and partial view contains some very basiic markup.</p>
  
  <pre><code>&lt;h2&gt;Our Commitment to privacy&lt;/h2&gt;
  This is sample priavcy policy.
  </code></pre>
  
  <p>In AjaxDemo.js file whose path is given in index.cshtml file i have small code</p>
  
  <pre><code>$(document).ready(function() {
      $('privacyLink').click(function(event) {
          event.preventDefault();
  
          var url = $(this).attr('href');
          $('#privacy').load(url);
      });
  });
  </code></pre>
  
  <p>now when I run this application and manually give the link as <code>http://localhost:19208/customajax</code></p>
  
  <p>I get error saying</p>
  
  <pre><code>The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".
  
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
  
  Exception Details: System.Web.HttpException: The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/_Layout.cshtml": "head".
  </code></pre>
  
  <p>any idea what's the mistake that I'm doing here?</p>
  
  <p>The <code>_Layout.cshtml</code> is as default, I haven't changed anything to it</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;title&gt;@ViewBag.Title - My ASP.NET MVC Application&lt;/title&gt;
          &lt;link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /&gt;
          &lt;meta name="viewport" content="width=device-width" /&gt;
          @Styles.Render("~/Content/css")
          @Scripts.Render("~/bundles/modernizr")
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;header&gt;
              &lt;div class="content-wrapper"&gt;
                  &lt;div class="float-left"&gt;
                      &lt;p class="site-title"&gt;@Html.ActionLink("your logo here", "Index", "Home")&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;div class="float-right"&gt;
                      &lt;section id="login"&gt;
                          @Html.Partial("_LoginPartial")
                      &lt;/section&gt;
                      &lt;nav&gt;
                          &lt;ul id="menu"&gt;
                              &lt;li&gt;@Html.ActionLink("Home", "Index", "Home")&lt;/li&gt;
                              &lt;li&gt;@Html.ActionLink("About", "About", "Home")&lt;/li&gt;
                              &lt;li&gt;@Html.ActionLink("Contact", "Contact", "Home")&lt;/li&gt;
                          &lt;/ul&gt;
                      &lt;/nav&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/header&gt;
          &lt;div id="body"&gt;
              @RenderSection("featured", required: false)
              &lt;section class="content-wrapper main-content clear-fix"&gt;
                  @RenderBody()
              &lt;/section&gt;
          &lt;/div&gt;
          &lt;footer&gt;
              &lt;div class="content-wrapper"&gt;
                  &lt;div class="float-left"&gt;
                      &lt;p&gt;&amp;copy; @DateTime.Now.Year - My ASP.NET MVC Application&lt;/p&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/footer&gt;
  
          @Scripts.Render("~/bundles/jquery")
          @RenderSection("scripts", required: false)
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>