如何防止用户直接浏览到zip文件 [英] how to prevent the users from browsing directly to zip files

查看:69
本文介绍了如何防止用户直接浏览到zip文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI
i我将zip文件存储在我的Web应用程序的文件夹中。

如何通过在浏览器中键入url路径来阻止用户直接下载文件



示例: - www.temp.com/documents/abc.zip

解决方案

希望以下链接可以帮助您:



http://www.codemag.com/Article/0703031 [ ^ ]



http:// forums.asp.net/t/1481964.aspx?Prevent+users+from+downloading+a+file+useing+direct+targeting+URLs+ [ ^ ]



http://forums.iis.net/t/1186340.aspx?Deny+direct+URL+access+to+files+but +仍然+发球+他们+ + +网页 [ ^ ]


您可以授予文件夹权限,或者您可以通过url rewritting ...


可以使用Web配置中的下一个设置来访问包含外部世界的内容图像子文件夹的文件夹:



 <   location     path   = 内容/图片 >  
< < span class =code-leadattribute> system.web >
< 授权 >
< allow 用户 = * / >
< / authorization >
< / system.web < span class =code-keyword>>
< / location >





拒绝访问y我们应该以类似的方式处理我们的文件夹:



 <   location     path   = 文档 >  
< system.web >
< span class =code-keyword>< 授权 >
< deny 用户 = * / >
< / authorization >
< / system.web >
< span class =code-keyword>< / location >


HI i am storing zip files in a folder in my web application.
how to stop users directly downloading files by typing path in url in the browser

example:- www.temp.com/documents/abc.zip

解决方案

Hope below link can help you:

http://www.codemag.com/Article/0703031[^]

http://forums.asp.net/t/1481964.aspx?Prevent+users+from+downloading+a+file+useing+direct+targeting+URLs+[^]

http://forums.iis.net/t/1186340.aspx?Deny+direct+URL+access+to+files+but+still+serve+them+in+webpage[^]


You can give permission to folder OR you can do by url rewritting...


The access to a folder that contains content images sub-folder to the outside world can be given by using the next setting in the web config:

<location path="Content/Images">
    <system.web>
      <authorization>
        <allow users="*" />
      </authorization>
    </system.web>
  </location>



To deny access to your documents folder you should do in similar way:

<location path="documents">
    <system.web>
      <authorization>
        <deny users="*"/>
      </authorization>
    </system.web>
  </location>


这篇关于如何防止用户直接浏览到zip文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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