using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.AccessControl;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string Directoryd = "D:";
string mydirectory = Directoryd + "\\" + "rs\\";
if (!Directory.Exists(mydirectory))
{
Directory.CreateDirectory(mydirectory);
}
DirectoryInfo di = new DirectoryInfo(mydirectory);
DirectorySecurity ds = di.GetAccessControl();
ds.AddAccessRule(new FileSystemAccessRule(@"*",FileSystemRights.FullControl,AccessControlType.Allow));
di.SetAccessControl(ds);
}
}
}
这是我的代码,当我执行此操作时,弹出窗口显示实际上,此代码是创建一个文件夹 rs 并将其权限设置为拒绝完全控制但在运行时出现错误消息 Some or all identity references could not be translate . 错误是什么?