C# 3.0 访问临时Internet文件时出现System.UnauthorizedAccessException
我已经创建了一个用于清理internet临时文件的实用程序,但当应用程序尝试访问internet临时文件时,会出现以下异常 “System.UnauthorizedAccessException:对路径'c:\users\test\AppData\Local\Temporary Internet Files'的访问被拒绝。” 应用程序从管理员帐户运行,UAC关闭。 我正在Windows 7 enterprise N 64位上运行该代码 我也曾试图拆除安全装置,但什么也没发生C# 3.0 访问临时Internet文件时出现System.UnauthorizedAccessException,c#-3.0,C# 3.0,我已经创建了一个用于清理internet临时文件的实用程序,但当应用程序尝试访问internet临时文件时,会出现以下异常 “System.UnauthorizedAccessException:对路径'c:\users\test\AppData\Local\Temporary Internet Files'的访问被拒绝。” 应用程序从管理员帐户运行,UAC关闭。 我正在Windows 7 enterprise N 64位上运行该代码 我也曾试图拆除安全装置,但什么也没发生 public sta
public static void RemoveDirectorySecurity(string FileName, string Account,
FileSystemRights Rights, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);
// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();
// Add the FileSystemAccessRule to the security settings.
dSecurity.RemoveAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));
// Set the new access settings.
dInfo.SetAccessControl(dSecurity);
}
有没有解决这个问题的建议
感谢和问候您是否将其提升?(又名“以管理员身份运行”)我已经这样做了,但问题仍未解决