views:

42

answers:

1

Hi,

I am trying to read from a config file in ProgramFiles/MyApp but in Windows 7 it throws an exception for Access denied, it is the same and for a file in ProgrammData/MyApp:

fileStream = new FileStream(this.StorageName, FileMode.Open, FileAccess.Read);

Is not it allowed to read only from these folders?

A: 

take a look at this: http://social.msdn.microsoft.com/forums/en-us/windowsgeneraldevelopmentissues/thread/53660459-EC32-4819-9213-5190F5A1B885

it seems to be an UAC issue, and you should relocate your information according to nmahajan.

This one is even better: http://social.msdn.microsoft.com/Forums/en/windowsgeneraldevelopmentissues/thread/dd28741a-1025-4ca2-a88b-95a5ea156e7f

Quoting GTVic:

1 - C:\Users\username\Documents
2 - C:\Users\username\AppData\Local
3 - C:\Users\username\AppData\Roaming
4 - C:\Users\Public\Documents
5 - C:\ProgramData
Use for:
1 - data private to one user while logged onto one specific computer
the database files can be easily found by the user by browsing their Documents folder

2 - data private to one user while logged onto one specific computer
the database files are in a hidden folder but may be accessible by a skilled user

3 - data private to one user while logged onto any networked computer
the database files are in a hidden folder but may be accessible by a skilled user

4 - data public to any user logged onto a specific computer
the database files can be easily found by the user by browsing the public Documents folder

5 - data public to any user logged onto a specific computer
the database files are in a hidden folder but may be accessible by a skilled user

DyP
There's no reason why read-only,program-specific configuration information cannot reside in the Program Files directory with the program itself.
Adrian McCarthy