Changing Folder Permissions C#
-
Does anyone know how to change folder permissions on Windows XP using C#? My problem is that when my application is run under the restricted account under windows XP the folder All Users Application Data has only read access. I want to add write access to that folder the first time the application is run. The application has to be run by an administrator first so I was hoping to do it then. Any Ideas? Forever Developing
-
Does anyone know how to change folder permissions on Windows XP using C#? My problem is that when my application is run under the restricted account under windows XP the folder All Users Application Data has only read access. I want to add write access to that folder the first time the application is run. The application has to be run by an administrator first so I was hoping to do it then. Any Ideas? Forever Developing
-
Does anyone know how to change folder permissions on Windows XP using C#? My problem is that when my application is run under the restricted account under windows XP the folder All Users Application Data has only read access. I want to add write access to that folder the first time the application is run. The application has to be run by an administrator first so I was hoping to do it then. Any Ideas? Forever Developing
There's a couple of articles on this here on code project. A quick search revealed:
You could search for additional articles, as well as comments in this forum because it has been discussed several times before. You probably shouldn't modify the ACL of the All Users directory, though. Users should not be able to write files to this directory. If you need the application to save files in a place where other users of the machine can access them, you should consider installing your program into C:\Program Files (where applications are supposed to go anyway) and use a folder within that. By default, most users can write to those directories. All Users is more for things like Start menu shortcuts available to everyone. Occassionally, net admins will put a README file in the Documents folder or something that user can't delete, but this is pretty rare these days with modern networks.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
-
There's a couple of articles on this here on code project. A quick search revealed:
You could search for additional articles, as well as comments in this forum because it has been discussed several times before. You probably shouldn't modify the ACL of the All Users directory, though. Users should not be able to write files to this directory. If you need the application to save files in a place where other users of the machine can access them, you should consider installing your program into C:\Program Files (where applications are supposed to go anyway) and use a folder within that. By default, most users can write to those directories. All Users is more for things like Start menu shortcuts available to everyone. Occassionally, net admins will put a README file in the Documents folder or something that user can't delete, but this is pretty rare these days with modern networks.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----
I am only saving a .ini file there. The problem with saving the ini file settings to the application root folder is that under windows XP a restricted user has no rights to the program files folder. Thanks for the information it is greatly appriciated. Nick Forever Developing
-
I am only saving a .ini file there. The problem with saving the ini file settings to the application root folder is that under windows XP a restricted user has no rights to the program files folder. Thanks for the information it is greatly appriciated. Nick Forever Developing
You should consider doing this in the setup of your application or using a separate .ini file for each user.
-----BEGIN GEEK CODE BLOCK----- Version: 3.21 GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++ -----END GEEK CODE BLOCK-----