江湖救急,高手请进!!!Windows 2003 中文件夹的权限自动继承到文件夹下的文件

jzhan 2008-10-20 03:50:43
现在我又一个web页面,会先从ftp上下载一个txt(file.txt)文件然后放在iis server上的C:\AAA这个文件夹下,然后web页面的程序在把这个文件(file.txt)的内容读出来显示在页面上.

但是现在遇到一个问题.
1. file.txt这个文件能够正常的从ftp上下载到iis server上的C:\AAA 文件夹里.(ftp的下载方式就是用Windows自带的ftp.exe + ftp的指令文件)
2. 但是当我的web 程序去读这个file.txt文件的时候,会有error Access to the path "C:\AAA\file.txt" is denied. 具体的描述如下,
Exception Details: System.UnauthorizedAccessException: Access to the path "C:\AAA\file.txt" is denied.

ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

我在文件夹C:\AAA上给了asp.net Machine Account 为读写权限, 但是从ftp下载来的文件的权限却没有自动继承asp.net machine account, 只有administration和system.
要怎么样才能让文件file.txt在下载后自动继承asp.net machine account的读写权限.

高手们来啊~~~~~
...全文
385 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
CloneCenter 2008-10-23
  • 打赏
  • 举报
回复
这个问题就是权限的问题,IIS运行时程序使用的帐号是ASPNET或者是network service,这个用户对绝大多数的目录是没有读取权限的,这个是安全性的一个问题。

默认下载到C:\是不好的。

解决的办法,当然是可以将C:\的目录安全修改为可以让IIS的帐号读取,但是不是个好办法,安全隐患比较大。
解决办法一:在自己的应用程序中列出一个目录,专门存放这些下载的文件,在Web程序安装好之后,管理员对这个目录设置aspnet帐号可读写的权限;
解决办法二:将下载的文件保存到 System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) 这个文件夹下,这个是系统所有用户都可以读取、写入的公共目录,不存在权限分配的问题。
xldata 2008-10-23
  • 打赏
  • 举报
回复
在AAA中的文件夹权限中的高级选项窗口中勾选"允许父项的继承权限传播到该对象及子对象. ..."
mjjzg 2008-10-20
  • 打赏
  • 举报
回复
去IIS里面此站点下看看属性是否有写入权限,
满衣兄 2008-10-20
  • 打赏
  • 举报
回复
在Web中不能任意设置文件夹的权限,如果能设置就没有安全性可言了。
解决方法是下载的同时读取文件中的内容或者从服务器上读,而不是等到用户下载到本地再到本地去读。
GSDante 2008-10-20
  • 打赏
  • 举报
回复
把存放file.txt路径改到项目在机器上的绝对路径下面试试。

例如:通常IIS中的项目路径为C:\Inetpub\wwwroot\项目名称
那么你放到C:\Inetpub\wwwroot\项目名称\AAA


另外,你说的改读写权限的问题。。。要看你是什么系统。。。XP我不知道要怎么弄。
NT和Server版直接给asp.net帐户C:\AAA文件夹的读写权限就行了。
twtetg 2008-10-20
  • 打赏
  • 举报
回复
To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group.
若要授予ASP.NET写入权限的文件,右键单击该文件,选择“属性” ,然后选择安全选项卡。点击“添加”添加适当的用户或组。
IMAGSE 2008-10-20
  • 打赏
  • 举报
回复
帮你顶,没有弄过。。。

16,722

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧