tags:

views:

109

answers:

4

Hi

I want to store some files and edit them for my software in Common Application Data under windows 7 ,

I do not know why Windows 7 do not allow My software tho change files unless I run as administrator .

where can I store my files , so I will not require Admin Permission ?

regards

+2  A: 

You need to use elevation in order to modify those files, due to User Access Control. Take a look at this MSDN article for more details: MSDN article about UAC

If you are not sure how to do this in C#, here is an article: Article about requesting elevation in C#

Michael Goldshteyn
+0: Requesting elevation just to save application settings is a bad idea.
Brian
A: 
Scott Chamberlain
I have used this , and stored my files in this folder , but windows do not allow change !
Ata
Hmmm, I just checked my permissions on C:\ProgramData and it is read only... Hmmm
Scott Chamberlain
No , I have used CommonApplicationData , where can I store my files , so I will not require Admin Permission .
Ata
If your goal is to have settings shared between all users on a machine, this is a good solution. If not, try one of my suggestions. Turning off UAC is not a good way to fix this problem.
Brian
A: 

It's a security option turned on by default in windows 7 namely UAC (user Account Control). You should change your design (write somewhere else) or turn off UAC from control panel\User Accounts.

Xaqron
+1  A: 

You should store your application data in a subfolder under Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); . Note that this folder is user-specific.

Non-Admin users do not have permission to write to the CommonApplicationData folder, because that folder does not belong to specific users.

Note that you can also store your settings by using the Settings Class. To do so, add New Item to your project, pick "Settings File". This is appropriate for basic settings like strings and numbers.

Brian