Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to cast object of type 'ASP._Page_Areas_Admin__ViewStart_cshtml' to type 'System.Web.WebPages.StartPage'
    primarykey
    data
    text
    <p>I created an area named "Admin".</p> <p>In /Areas/Admin/Views/, I have _ViewStart.cshtml with this:</p> <pre><code>@{ Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml"; } </code></pre> <p>I'm getting the following error when I visit a page in /Admin/: <strong>Unable to cast object of type 'ASP._Page_Areas_Admin__ViewStart_cshtml' to type 'System.Web.WebPages.StartPage'.</strong></p> <p>I made the suggested changes from <a href="https://stackoverflow.com/questions/4109205/how-do-i-use-a-common-viewstart-in-areas">How do I use a common _ViewStart in areas?</a>.</p> <p>I have this in my web.config in the root, and the web.config at /Areas/Admin/Views/:</p> <pre><code>&lt;configSections&gt; &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt; &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt; &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;system.web.webPages.razor&gt; &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt; &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt; &lt;namespaces&gt; &lt;add namespace="System.Web.Mvc" /&gt; &lt;add namespace="System.Web.Mvc.Ajax" /&gt; &lt;add namespace="System.Web.Mvc.Html" /&gt; &lt;add namespace="System.Web.Routing" /&gt; &lt;/namespaces&gt; &lt;/pages&gt; &lt;/system.web.webPages.razor&gt; &lt;appSettings&gt; &lt;add key="webpages:Version" value="1.0.0.0"/&gt; &lt;add key="webpages:Enabled" value="false" /&gt; &lt;add key="ClientValidationEnabled" value="true"/&gt; &lt;add key="UnobtrusiveJavaScriptEnabled" value="true"/&gt; &lt;/appSettings&gt; </code></pre> <p>Anyone know what I'm doing wrong here?</p> <p><strong>EDIT:</strong> Don't know if this helps, but if I delete the code in _ViewStart.cshtml so that it's empty, I'm able to view the pages in /Admin without getting an error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload