> ## Content Index
> Fetch the complete content index at: https://blog.jsinh.in/llms.txt
> Use this file to discover other available public pages before exploring further.

# ASP.NET MVC - The view must derive from WebViewPage, or WebViewPage<TModel>
- URL: https://blog.jsinh.in/asp-net-mvc-the-view-must-derive-from-webviewpage-or-webviewpagetmodel/
- Published: 2015-06-16T09:17:15.000Z
- Updated: 2026-07-07T15:06:52.000Z
- Author: Jsinh
- Tags: #Import 2026-10-04 19:16

Did you encountered following exception / error when trying to run ASP.NET MVC web application?

> The view must derive from WebViewPage, or WebViewPage

![View must derive from WebViewPage error](https://blob.jsinh.in/media/2015/06/16/SS01-view_must_derive_webviewpage.png)

or

> Type 'ASP.\_Page\_Views\_\_ViewStart\_cshtml' does not inherit from 'System.Web.WebPages.StartPage'.

![ViewStart does not inherit from System.Web.WebPages.StartPage](https://blob.jsinh.in/media/2015/06/16/SS02-viewstart_doesnot_inherit_startpage.png)

I encountered while I was playing with MVC 5 (applies to MVC 3 and 4 also) application.

Every razor page should inherit from `System.Web.Mvc.WebViewPage`. You can resolve this issue by adding following line at the top in each view razor (\*.cshtml) page:

```
@inherits System.Web.Mvc.WebViewPage

```

and add following line at the top of `_ViewStart.cshtml` :

```
@inherits System.Web.Mvc.ViewStartPage

```

or you can add a `web.config` file and add following (in root of Views folder where the Razor pages reside)

```
<?xml version="1.0"?>

<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.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=5.2.2.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:Enabled" value="false" />
  </appSettings>

  <system.webServer>
    <handlers>
      <remove name="BlockViewHandler"/>
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

```

In [MVC application there are two web.config files](https://blog.jsinh.in/man-002-tale-of-two-web-config-in-mvc/#.VX%5FHTPmUcmM), one in the root of the main application and other in root of `Views` folder where the Razor pages reside.

Happy Coding !!