移动后正确设置文件的权限
我将文件从一个位置传输到另一个位置。问题是当我将文件传输到新位置时,文件的权限是移动之前的权限。
假设我有用户“A”、用户“B”文件夹“F1”和文件夹“F2”
用户“A”有权访问文件夹“F1”中的文件。我在 c# 中执行此代码,将文件从文件夹“F1”移动到文件夹“F2”。
File.Move(filePath, copyPath2);
在文件夹“F2”中,用户“A”无权访问这些文件。当我查看移动后的权限时,“F2”文件夹中文件的所有权限都设置为“F1”文件夹的权限。
当我在 C# 中将文件从一个位置移动到另一个位置时,有没有办法删除权限?
我在 Windows 2008 r2 中,我尝试这样做的原因写在 帖子。这是 ARR 模块和 IIS 文件句柄的问题
I transfer a file from one location to another. The problem is when I transfer the file to the new location, the permissions on the file are what they were before I moved it.
Suppose I have User "A", User "B" folder "F1" and folder "F2"
The user "A" has access to files in the folder "F1". I execute this code in c# to move my files from folder "F1" to folder "F2"
File.Move(filePath, copyPath2);
In the folder "F2" the user "A" did not has access to the files. When I look at the permission after the move, all the permissions on the files in the "F2" folder, are set the permission from "F1" folder.
Is there a way when I move files from a location to another in c#, to remove permissions?
I am in windows 2008 r2 and the reason i try to do that is writed on this post. It's a problem with ARR modules and IIS file handle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 MSDN 论坛中的此主题:
http://social.msdn.microsoft.com/Forums/hu-HU/netfxbcl/thread/51694aec-90d2-4d90-8e9a-af0ab91cc610
这是对您的问题的简单调整:
Have a look at this thread from MSDN forums:
http://social.msdn.microsoft.com/Forums/hu-HU/netfxbcl/thread/51694aec-90d2-4d90-8e9a-af0ab91cc610
Here's a simple adaption to your question: