Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4619266
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:24:04+00:00 2026-05-22T02:24:04+00:00

I created an area named Admin. In /Areas/Admin/Views/, I have _ViewStart.cshtml with this: @{

  • 0

I created an area named “Admin”.

In /Areas/Admin/Views/, I have _ViewStart.cshtml with this:

@{
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}

I’m getting the following error when I visit a page in /Admin/: Unable to cast object of type ‘ASP._Page_Areas_Admin__ViewStart_cshtml’ to type ‘System.Web.WebPages.StartPage’.

I made the suggested changes from How do I use a common _ViewStart in areas?.

I have this in my web.config in the root, and the web.config at /Areas/Admin/Views/:

<configSections>
  <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">
    <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" />
    <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" />
  </sectionGroup>
</configSections>

<system.web.webPages.razor>
  <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <pages pageBaseType="System.Web.Mvc.WebViewPage">
    <namespaces>
      <add namespace="System.Web.Mvc" />
      <add namespace="System.Web.Mvc.Ajax" />
      <add namespace="System.Web.Mvc.Html" />
      <add namespace="System.Web.Routing" />
    </namespaces>
  </pages>
</system.web.webPages.razor>

<appSettings>
  <add key="webpages:Version" value="1.0.0.0"/>
  <add key="webpages:Enabled" value="false" />
  <add key="ClientValidationEnabled" value="true"/>
  <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>

Anyone know what I’m doing wrong here?

EDIT: 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:24:04+00:00Added an answer on May 22, 2026 at 2:24 am

    _ViewStart.cshtml files can only be placed into a Views folder. The exception you are getting very strongly suggests that you have not placed the _ViewStart.cshtml inside the ~/Areas/Admin/Views/ folder (at the same level as the web.config).

    Here’s how a correct project structure should look like:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an areas -> Admin. In my register area, I have: public override
I've created an Area named Admin. I've created also a controller(Pages) and a view(List)
I have created an application that has a toolbar, menubar and content area. I
I have created one html form with following fields: Name (Text Box) Email (Text
I have a new MVC-2 project where I added the area 'member'. I created
I create a new area in my asp.net mvc 3 solution named admin .
Noob Question here. I have created and successfully added an additional Page Layout to
I have created new payment method (gateway). In this gateway I sending information to
I can create the following and reference it using area[0].states[0] area[0].cities[0] var area =
My route looks like the following: map.namespace(:admin) do |admin| admin.resources :pages end and my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.