string windowsDirectory = Environment.GetEnvironmentVariable("ProgramFiles");
string mydirecoty = windowsDirectory + "\\" + "NetServices\\";
if (!Directory.Exists(mydirecoty))
{
Directory.CreateDirectory(mydirecoty); //Access to the path 'C:\Program Files (x86)\NetServices\' is denied.
}
exception is thrown when I run my .net application without Administrator account. While If I try to create directory in other then C:\
drive like D:\
it runs fine.
What is solution that I want to create directory in Program Files/ Windows
folder?