我试图授予用户访问该文件夹的权限,但是当我尝试运行该程序时,错误说:Some or all identity references could not be translated.
这是我正在使用的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
using System.Security;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Management;
using System.Management.Instrumentation;
namespace FolderLock
{
    public partial class Lock : Form
    {
        public Lock()
        {
            InitializeComponent();
            SetAccess();
        }
        private void Lock_Load(object sender, EventArgs e)
        {
        }
        public void SetAccess()
        {
            DirectoryInfo myDirectoryInfo = new DirectoryInfo("C:/Users/Trov/Desktop/Test");
            DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
            string …c# ×1