Deny users to access a folder

被刻印的时光 ゝ 提交于 2019-12-13 18:28:02

问题


I have this upload file structure link localhost:58707/uploads/interaction/5/Chrysanthemum.jpg

I want to deny all the users to access '~/uploads' directly..

So, I put this in my web.config as I see in others questions here:

  <location path="~/uploads"> //I've tried '/upload' and 'upload' too.
    <system.webServer>
      <directoryBrowse enabled="false" />
    </system.webServer>
  </location>

But it doesn't work. How can I do this?


回答1:


Check this answer ..

Deny access to 'admin' folder in web.config

Also

http://www.sitefinity.com/devnet/kb/sitefinity-3-x/how-to-restrict-the-access-to-a-given-folder-for-a-specific-role.aspx




回答2:


This solution is working for my project: Use App_Data



来源:https://stackoverflow.com/questions/12694964/deny-users-to-access-a-folder

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