设置文件系统访问规则时出现问题
在我的本地网络上的应用程序中,任何用户都应该使用此代码在共享文件夹上创建一个目录。例如,test1 是用户文件夹之一的名称。
DirectoryInfo di = new DirectoryInfo(@"\\Server\Test\test1");
DirectorySecurity ds=new DirectorySecurity();
ds.SetAccessRule(new FileSystemAccessRule(Enviroment.Username,
FileSystemRights.FullControl, AccessControlType.Deny));
di.Create(ds);
现在,当域中的管理员想要读取任何用户的每个目录时,就会发生此错误:
试图执行未经授权的操作
管理员运行的代码是:
DirectoryInfo di = new DirectoryInfo(@"\\Server\Test\test1");
DirectorySecurity ds=new DirectorySecurity();
ds.SetAccessRule(new FileSystemAccessRule(Enviroment.Username,
FileSystemRights.FullControl, AccessControlType.Allow));
di.SetAccessControl(ds);
我的错误在哪里?
提前致谢。
In my app on local network, any user should create a directory on shared folder using this code. test1 is the name of one of the user's folder for example.
DirectoryInfo di = new DirectoryInfo(@"\\Server\Test\test1");
DirectorySecurity ds=new DirectorySecurity();
ds.SetAccessRule(new FileSystemAccessRule(Enviroment.Username,
FileSystemRights.FullControl, AccessControlType.Deny));
di.Create(ds);
Now when the admin in domain wants to read every directory from any user this error ocurred:
Attempted to perform an unauthorized operation
The code that the admin runs is:
DirectoryInfo di = new DirectoryInfo(@"\\Server\Test\test1");
DirectorySecurity ds=new DirectorySecurity();
ds.SetAccessRule(new FileSystemAccessRule(Enviroment.Username,
FileSystemRights.FullControl, AccessControlType.Allow));
di.SetAccessControl(ds);
Where is my mistake?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以尝试像下面这样吗
Can you try like the below