I just started a new MVC 3 project. Can anyone tell me what
<add key="webpages:Enabled" value="false" />
in my web.config file does?
I just started a new MVC 3 project. Can anyone tell me what
<add key="webpages:Enabled" value="false" />
in my web.config file does?
webPages:enabled
with value false
prevents .cshtml
or .vbhtml
files in the Views
folder from being directly accessible from a web browser.
The type of page you have requested is not served because it has been explicitly forbidden
–
Fala According to documentation it prevents .cshtml and .vbhtml files from being accessed directly (www.myweb.com/views/home/index.cshtml
for example)
<add key="webpages:Enabled" value="???">
entirely. Is the default true
or false
? –
Maratha null
- meaning that webpages are enabled if application contains any *.cshtml
or *.vbhtml
files. Checking for files can be either disabled by setting this value to true
or false
. You can see for yourself here. –
Millibar To allow Razor pages to be served, it's not enough to set <add key="webpages:Enabled" value="true" />
. You also need to add the Microsoft.AspNet.WebPages package to packages.config
using NuGet.
© 2022 - 2024 — McMap. All rights reserved.