如何在asp.net中限制文件夹访问 [英] How to restrict folder access in asp.net

查看:25
本文介绍了如何在asp.net中限制文件夹访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中限制文件夹访问就像我不希望任何其他人通过链接在浏览器中看到我的上传文件夹 http://www.example.com/上传

How to restrict folder access in asp.net like I don't want any other to see my Uploads folder in browser by link http://www.example.com/Uploads

推荐答案

对于下一代,对我有用的答案是使用隐藏段.

For the future generation the answer which works for me is to use hidden segments.

如果你想保护例如Uploads 文件夹转到您的根 Web.config 并添加到 以下元素:

If you want to secure e.g. Uploads folder go to your root Web.config and add into <system.webServer> following element:

<security>
  <requestFiltering>
    <hiddenSegments>
      <add segment="Uploads"/>
    </hiddenSegments>
  </requestFiltering>
</security>

这将阻止所有用户直接访问Uploads文件夹及其内容.

This will prevent all users from direct access to Uploads folder and its content.

这篇关于如何在asp.net中限制文件夹访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆