Reputation: 2300
I write a C# application that needs to write in a file that is in the program files folder in Windows Drive. and for this, I must run my app as administrator otherwise an error happened. I want to run my app in normal form ( not as administrator ). Is there a solution?
Upvotes: 2
Views: 3794
Reputation: 127593
You have a few options (in order of preferred option)
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
Users
group can write to the folder instead of only being able to read it.Upvotes: 3
Reputation: 32691
Add an application manifest file from project-->Add File-->Manifest and change this line as
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
Upvotes: 2