我始终授予应用程序池身份对 Web 文件夹的只写权限。
但是,有些人授予他们读写权限。
问题是
Is it necessary to grant an application pool identity a read permission on the web folder? Does granting a write permission suffice?
编辑 1
到目前为止,我授予只写权限没有遇到任何问题。
您能举一个需要读取权限的案例吗?
编辑2
我在 App_Data
文件夹中有一个 data.txt
,在我的操作方法中,我的代码如下:
using (StreamReader sr = new StreamReader(Server.MapPath("~/App_Data/data.txt")))
{
string text = sr.ReadToEnd();
// do more things here.
}
到目前为止一切顺利。
编辑3
我有一个文件夹Content
,其中包含一堆 pdf 文件。用户仍然可以下载它们。
最佳答案
这里写得很好:Why can I upload a file without IIS Write Permission?
"Read" access controls whether the HTTP GET verb is allowed.
"Write" access controls whether HTTP PUT verb is allowed.
关于asp.net - 是否需要授予应用程序池身份对Web文件夹的读取权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5255752/