简体   繁体   English

IIS7和文件权限

[英]IIS7 and file permission

I have a text file in my virtual directory. 我的虚拟目录中有一个文本文件。 My problem is that when a user gives the url for this file in a browser, its contents are returned. 我的问题是,当用户在浏览器中提供此文件的url时,将返回其内容。 My web application is reading from and writing to it but I don't want to show it to user. 我的Web应用程序正在读写它,但我不想向用户显示。 How to set permissions of this file or configure IIS7 to achieve this task? 如何设置此文件的权限或配置IIS7以完成此任务?

You can move the file out of your web site folder into a place like c:\\datafiles. 您可以将文件从网站文件夹中移到c:\\ datafiles之类的位置。 Give the IIS account read/write access to it and then there is no way a web user can get it. 向IIS帐户授予对其的读/写访问权限,然后Web用户无法获取它。

EDIT: Or you could change the extension to something that is not severed by IIS like .config 编辑:或者您可以将扩展名更改为不被IIS切断的扩展名,例如.config

Also you can Remove the Read permission from IUSER account. 您也可以从IUSER帐户中删除读取权限。 for more security keep read and write permission for ASPNET MACHINE and SYSTEM. 为了提高安全性,请保留对ASPNET MACHINE和SYSTEM的读写权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM