上载文件的文件夹权限
你好-
我对此问题感到绝望,我正确设置了所有权限(我认为),但仍然无法在服务器上上传文件.我在尝试上传文件时收到访问被拒绝的错误.
我将权限设置为能够在物理文件夹和iis中为Internet来宾,网络服务和asp.net进行写.
我想念什么?
在此先感谢
Hello -
I am desperate with this issue, I set all the permissions correctly (I think), but I still can''t upload file on the server. I am receiving error that access is denied when I am trying to upload the file.
I set the permissions to be able to write for Internet guest, network service and asp.net in both physical folder and in the iis.
What am i missing?
Thanks in advance
至于您的文件上传问题,上传目录的位置是什么?是在应用程序的根目录下还是在计算机上的其他位置?另外,您是否会在其上添加一些特定的访问权限控制,或者只是允许您的ASP.NET应用程序对其进行完全控制?
通常,对于您的方案,您可以先检查以下两件事:
1.您的保存文件代码是否引用了正确的目录路径.
在ASP.NET应用程序中,如果要引用应用程序根目录下的子目录,则可以使用〜/subdir"样式路径和用户Server.MapPath
将其映射到物理路径.例如
As for your file uploading issue, what''s the upload directory''s position? Is it under your application''s root directory or in another place on the machine? Also, would you add some particular access permission control on it or simply allow your ASP.NET application to have full control over it?
Generally, for your scenario, you can check the following two things first:
1. Whether your save file code has refer to the correct directory path.
In ASP.NET application, if you want to reference a sub directory under your application root directory, you can use the "~/subdir" style path and userServer.MapPath
to map it to physical path. e.g.
protected void Page_Load(object sender, EventArgs e)
{
string path = Server.MapPath("~/uploadfiles/");
Request.Files[0].SaveAs(path +
Path.GetFileName(Request.Files[0].FileName));
}
2.如果路径正确,则可以检查ASP.NET工作进程的安全身份,以查看其是否具有访问目标目录的足够权限. IIS5和IIS6之间的ASP.NET进程标识模式有所不同(IIS5使用MACHINE \ ASPNET帐户,而IIS6默认使用NT AUTHORITY \ NETWORK SERVICE),可以参考以下参考资料:
#配置ASP.NET进程标识
http://msdn2.microsoft.com/en-us/library/dwc1xthy.aspx [ ^ ]
获得ASP.NET应用程序的执行帐户后(安全性
身份),则可以检查其对要保存文件的目录的访问权限.
参考:
http://bytes.com/topic/asp-net/answers/578390-file-上传权限 [^ ]
http://www.daniweb.com/forums/thread43223.html [ http://forums.asp.net/p/984207/1264873.aspx [ ^ ]
2. If the path is correct, you can check your ASP.NET worker process''s security identity to see whether it has the sufficient permission to access the target directory. The ASP.NET process identity mode is different between IIS5 and IIS6(IIS5 use MACHINE\ASPNET account while IIS6 use NT AUTHORITY\NETWORK SERVICE by default), you can refer to the following reference:
#Configuring ASP.NET Process Identity
http://msdn2.microsoft.com/en-us/library/dwc1xthy.aspx[^]
After you get your ASP.NET application''s executing account(security
identity), you can check its access permission to the directory you want to save file.
Refer:
http://bytes.com/topic/asp-net/answers/578390-file-uploading-permission[^]
http://www.daniweb.com/forums/thread43223.html[^]
http://forums.asp.net/p/984207/1264873.aspx[^]