在ASP.NET中的文件夹的授权设置 [英] Authorization settings for a folder in ASP.NET

查看:83
本文介绍了在ASP.NET中的文件夹的授权设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个asp.net网站,我想限制所有用户访问一个名为登录文件夹,我在web.config中该元素:

I have an asp.net web site, I want restrict all users to access a folder named "log" and I have this element in web.config:

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

和这个元素之前它的System.Web:

and this element before it in system.web:

<authorization>
	<allow users="*"/>
</authorization>

但我仍然可以访问这个网址: http://www.mydomain.com/log /log.txt

任何想法?

感谢。

推荐答案

.TXT 文件不是由ASP.NET默认处理。你必须从IIS中阻止用户访问该文件夹。

.txt files are not handled by ASP.NET by default. You'll have to block access to the folder from within IIS.

如果您正在使用IIS 7,您可以使用请求筛选来实现这一目标。

If you're using IIS 7 you can use Request Filtering to achieve this.

这篇关于在ASP.NET中的文件夹的授权设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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