Ignoring a route in ASP.NET MVC

混江龙づ霸主 提交于 2019-12-05 00:01:44

Ignoring routes in MVC will tell the MVC framework not to pick up those URLs.

This means that it will let the underlying ASP.NET handle the request, which will happily show you a static file.

If you really want to block access to that folder, why not define it in web.config?

Place a web.config in that folder.

The contents should be:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.web>
        <authorization>
          <!-- <allow roles="admin" /> --> //In case you want to give access to admin only.
          <deny users ="*" />
        </authorization>
    </system.web>
</configuration>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!