Click here to Skip to main content
15,898,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This problem is coming when i run project that time master page through this exception.
The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/MainMaster.cshtml": "Container".


Exception:-
<pre>The following sections have been defined but have not been rendered for the layout page "~/Views/Shared/MainMaster.cshtml": "Container".

at System.Web.WebPages.WebPageBase.VerifyRenderedBodyOrSections()     at System.Web.WebPages.WebPageBase.PopContext()     at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)     at System.Web.WebPages.WebPageBase.<>c__DisplayClass7.<RenderPageCore>b__6(TextWriter writer)     at System.Web.WebPages.HelperResult.WriteTo(TextWriter writer)     at System.Web.WebPages.WebPageBase.Write(HelperResult result)     at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body)     at System.Web.WebPages.WebPageBase.PopContext()     at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)     at System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)     at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)     at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)     at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)     at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19()     at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)     at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<>c__DisplayClass2a.<BeginInvokeAction>b__20()     at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)


What I have tried:

I searched multiple times but no solution find.
Posted
Updated 8-Aug-17 6:24am
Comments

1 solution

Make sure that in your Views folder there's a file called "_ViewStart.cshtml" make sure that the content match with your 'master page' or Layout page (that's the name for MVC).
C#
@{
    Layout = "~/views/shared/mainmaster.cshtml";
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900