> ## 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.

# webpages:Enabled AppSetting in MVC
- URL: https://blog.jsinh.in/man-003-webpages-enabled-appsetting-mvc/
- Published: 2014-06-24T17:42:00.000Z
- Updated: 2026-07-07T15:11:28.000Z
- Author: Jsinh
- Tags: #Import 2026-10-04 19:16

If you open your web.config at root of your MVC project you will find bunch of default `appsetting` keys added by MVC or WebAPI.

One of the `appsetting` with key `webpapges:Enabled` is added which as default value as `false`.

So what is the deal with this appsetting?

To find out the answer to this simple question I started searching [ASP.NET WebStack codebase](https://aspnetwebstack.codeplex.com/SourceControl/latest?ref=blog.jsinh.in#src/System.Web.WebPages.Deployment/WebPagesDeployment.cs) on codeplex.

This `appsetting` is processed by the `System.Web.WebPages.Deployment` \- `WebPagesDeployment.cs` code.

Dry-running the code base I got answer to my query.

Three possibility for the `appsetting` \- `webpages:Enabled`:

1. Key - value not added at all or not having a valid boolean value.
2. Key - value added and set to `false`.
3. Key - value added and set to `true`.

**Case 1:** In this case when `PreApplicationStartCode` \> `Start` method is called which in turn calls > `StartCore` which internaly checks this application setting. If the value is not found or is null. The code base will search for any `*.cshtml` or `*.vbhtml` extension files and if found `Any()` then returns true or else false.

**Case 2:** In this case access to all view files directly is not allowed and you get error - `This type of page is not served`. Check by creating a `Test.cshtml` file in project root and try accessing directly via URL request, you will received a error similar to this one:

![View access forbidden](https://blob.jsinh.in/media/2014/06/25/man-0301-webpages-enabled-mvc.png)

**Case 3:** In this case access to any view files with `*.cshtml` or `*.vbhtml` extension will be served without any restrictions.

#### Now it gets interesting

Reference to my previous post of this **[Mordern ASP.NET (man series) # 002](https://blog.jsinh.in/man-002-tale-of-two-web-config-in-mvc/)** we talked about how access to view files directly under `Views` folder is restricted and redirected to HttpNotFoundHandler.

If you carefully observe the `web.config` files under the `Views` folder then you will observed that it also contains the `webpages:Enabled` application setting.

After playing a while with this setting and other settings in this `web.config`, I understand that this application setting plays important part in restricting access to `*.cshtml` or `*.vbhtml` from Views folder.

If this application setting ALONG with the config section from previous blog post (link mentioned above) are not set (either / or) the you will encounter following error:

![View does not inherit from System.Web.WebPages.WebPage](https://blob.jsinh.in/media/2014/06/25/man-0302-webpages-enabled-needed-view-webconfig-mvc.png)

*Type 'ASP.\_Page\_Views\_cshtml' does not inherit from 'System.Web.WebPages.WebPage'.*

**Moral:** This tini-tiny application setting is important.

Happy Coding !!