I'm trying to return the .config
files that exist in %WINDIR%\System32\inetsrv\config
.
For this I am using the following code:
DirectoryInfo configFolder = new DirectoryInfo(Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\System32\inetsrv\");
FileInfo[] configFiles = configFolder.GetFiles("*.config");
This returns zero objects into configFiles
. If I use another folder (say D:\DropBox) is works fine!
This code used to work, has something changed??
Also, FileInfo fi = new FileInfo(Path.Combine(configPath, "applicationHost.config"));
returns ok, but fi.Length throws FileNotFoundException
.
Seems it must be permissions, but I can't see how to check if I have permissions when the code runs!
Environment.ExpandEnvironmentVariables("%WINDIR%") + @"\System32\inetsrv\config"
– Votive