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?
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 topackages.config
using NuGet.According to documentation it prevents .cshtml and .vbhtml files from being accessed directly (
www.myweb.com/views/home/index.cshtml
for example)webPages:enabled
with valuefalse
prevents.cshtml
or.vbhtml
files in theViews
folder from being directly accessible from a web browser.