开发者

what is the function of webpages:Enabled in MVC 3 web.config

I just started a new MVC 3 project. Can anyone tell me what

<add key="webpages:Enabled" v开发者_开发百科alue="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.


According to documentation it prevents .cshtml and .vbhtml files from being accessed directly (www.myweb.com/views/home/index.cshtml for example)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜