Reputation: 1
When I am trying to create folder in this location C:\Program Files
I get an Error. solve this problem or how I can get windows Authorization in c# as below code
if(!(Directory.Exists(@"C:\Program Files\ClockResourse")))
{
Directory.CreateDirectory(@"C:\Program Files\ClockResourse");
}
Upvotes: 0
Views: 551
Reputation: 5298
You really should never create directories or anything else other than EXEs and static resources, see this answer. If you absolutely had to, and depending on what type of program you are actually running you would have to require admin rights for the program, but without further information that's as far as I can help.
Upvotes: 3