开发者

Why I get Access denied when try to read file from ProgramFiles/MyApp?

开发者 https://www.devze.com 2023-01-16 12:02 出处:网络
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 ProgrammDa开发者_如何学Pythonta/MyApp:

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 ProgrammDa开发者_如何学Pythonta/MyApp:

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

Is not it allowed to read only from these folders?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消