【发布时间】:2019-05-14 18:43:56
【问题描述】:
我正在开发 Asp.net MVC 应用程序。应用程序包含一个需要防止未经授权访问的文件夹。客户可以将具有任何扩展名的文件复制到此文件夹。客户不希望未经授权的人(未登录的人)通过直接访问浏览器 URL 中的文件来下载文件。
我不能使用 httpHandler,因为我们事先不知道文件的扩展名。
我还尝试在其授权部分保留单独的 web.config 和 <deny users="?"/>。但它仅适用于已知扩展名,对于未知扩展名会出现以下错误,
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
有人可以建议如何处理这种情况吗?
谢谢。
【问题讨论】:
标签: c# asp.net security directory file-extension