MVC 3 Won't Serve Content files from Areas subfolder

人走茶凉 提交于 2019-12-02 20:51:59

So after some sleep and, more importantly, stepping away from the problem I remembered that MVC does in fact offer you protection from people downloading views directly, which led me to remember the Web.config file required in the Areas folder. Sure enough, there's an httphandler that basically sends all requests to the FileNotFound handler.

All I had to do was drop a web.config file in the content folder I wanted to expose with the following:

<?xml version="1.0" encoding="utf-8"?>
<configuration>  
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="BlockViewHandler" />     
    </handlers>
  </system.webServer>
</configuration>

Problem solved.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!