paul frith paul frith - 4 months ago 12
Vb.net Question

Problems overwriting file in application folder

I have a file called

PolicyLookup.sql
that sits in my application's root folder. My app loads this file into a text box, so that users can edit it and overwrite the original file by pressing a save button. This all worked perfectly during test, however after deployment users are unable to save the file due to write issues within
C:\Program Files
.

Is there a way around this - or is there a better way to implement this type of thing? One solution that springs to mind for me is placing the contents of the
PolicyLookup.sql
file within a User Setting - however it intrinsically feels wrong to me to put the entire contents of a file within a settings variable.

Answer

Ordinary users do not have write permissions on %ProgramFiles%. If you need to save a configuration file then put it in a subfolder of %APPDATA% (which for me is C:\Users\Gord\AppData\Roaming) or some other place where a regular user is allowed to write.

Comments