![](/img/trans.png)
[英]WebClient Download - “Access to the path 'c:\\windows\\system32\\inetsrv\\MyPrintManager.exe' is denied”
[英]Access to the path 'c:\windows\system32\inetsrv\config\' is denied
if (Fubrowse.HasFile)
{
string path = Path.GetFullPath(Fubrowse.PostedFile.FileName);
//string root = Path.GetPathRoot(path);
GetFilesFromDirectory(path.Substring(0, path.LastIndexOf("\\")));
}
else
GeneralClass.ShowMessageBox("Please Select File First.");
}
private void GetFilesFromDirectory(string DirPath)
{
try
{
DirectoryInfo Dir = new DirectoryInfo(DirPath);
FileInfo[] FileList = Dir.GetFiles("*.cs", SearchOption.AllDirectories);
foreach (FileInfo FI in FileList)
在这里,路径是c:\windows\system32\inetsrv\config\
。 我想在FileList
数组中获取所有子目录的文件名。
运行您的代码的 Windows 帐户需要对该文件夹的读取权限(通常需要管理员权限)。
我遇到过同样的问题。 我无法从C:\Windows\system32\intesrv\config
获取文件,因为我的系统是 64 位,并且我的请求重定向到C:\Windows\SysWOW64\system32\intesrv\config
这个答案给出了更多解释。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.